# This file is auto-generated by oagen. Do not edit.

from __future__ import annotations

from dataclasses import dataclass
from typing import Any, Dict
from workos._types import _raise_deserialize_error


@dataclass(slots=True)
class CreateGroupMembership:
    """Create Group Membership model."""

    organization_membership_id: str
    """The ID of the Organization Membership to add to the group."""

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "CreateGroupMembership":
        """Deserialize from a dictionary."""
        try:
            return cls(
                organization_membership_id=data["organization_membership_id"],
            )
        except (KeyError, ValueError) as e:
            _raise_deserialize_error("CreateGroupMembership", e)

    def to_dict(self) -> Dict[str, Any]:
        """Serialize to a dictionary."""
        result: Dict[str, Any] = {}
        result["organization_membership_id"] = self.organization_membership_id
        return result
