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

from __future__ import annotations

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


@dataclass(slots=True)
class AgentRegistrationClaimCompletedDataClaimedBy:
    """The user who completed the claim."""

    user_id: str
    """The ID of the user who completed the claim."""
    organization_id: Union[str, Optional[Literal["null"]]]
    """The ID of the organization the claiming user belongs to."""

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

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