# 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 ClientApiToken:
    """Client Api Token model."""

    organization_id: str
    """The ID of the organization to scope the Client API token to."""
    user_id: str
    """The ID of the user to issue the Client API token for."""

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

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