# 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 AccessTokenAgentRegistrationCredentialIssuedDataDetail:
    """Access Token Agent Registration Credential Issued Data Detail model."""

    kind: Literal["access_token"]
    """The kind of credential issued."""
    jti: str
    """The JWT ID of the issued access token."""
    expires_at: Union[str, Optional[Literal["null"]]]
    """The timestamp when the access token expires."""

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

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