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

from __future__ import annotations

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


@dataclass(slots=True)
class AgentRegistrationCredentialIssuedDataDetail:
    """Agent Registration Credential Issued Data Detail model."""

    kind: Literal["api_key"]
    """The kind of credential issued."""
    api_key_id: str
    """The ID of the issued API key."""

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

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