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

from __future__ import annotations

from dataclasses import dataclass
from datetime import datetime
from typing import Any, Dict
from workos._types import _raise_deserialize_error
from workos._types import _format_datetime, _parse_datetime


@dataclass(slots=True)
class AgentRegistrationClaimClaimCompletion:
    """Agent Registration Claim Claim Completion model."""

    id: str
    """Unique identifier of the claim completion."""
    created_at: datetime
    """The timestamp when the claim completion was created."""
    updated_at: datetime
    """The timestamp when the claim completion was last updated."""
    expires_at: datetime
    """The timestamp when the claim completion expires."""
    claimed_at: datetime
    """The timestamp when the claim was completed."""

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "AgentRegistrationClaimClaimCompletion":
        """Deserialize from a dictionary."""
        try:
            return cls(
                id=data["id"],
                created_at=_parse_datetime(data["created_at"]),
                updated_at=_parse_datetime(data["updated_at"]),
                expires_at=_parse_datetime(data["expires_at"]),
                claimed_at=_parse_datetime(data["claimed_at"]),
            )
        except (KeyError, ValueError) as e:
            _raise_deserialize_error("AgentRegistrationClaimClaimCompletion", e)

    def to_dict(self) -> Dict[str, Any]:
        """Serialize to a dictionary."""
        result: Dict[str, Any] = {}
        result["id"] = self.id
        result["created_at"] = _format_datetime(self.created_at)
        result["updated_at"] = _format_datetime(self.updated_at)
        result["expires_at"] = _format_datetime(self.expires_at)
        result["claimed_at"] = _format_datetime(self.claimed_at)
        return result
