# 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 GroupMemberAddedData:
    """The event payload."""

    group_id: str
    """The ID of the Group."""
    organization_membership_id: str
    """The ID of the OrganizationMembership."""

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

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