# 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 AgentAdminLinkClaimAttemptToExternalUserRequestUser:
    """The user to attach to the claim attempt, identified by email and external ID."""

    email: str
    """The email address of the user."""
    external_id: str
    """The external ID of the user."""

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

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