# 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 AgentRegistrationOrganizationSwitchedData:
    """The event payload."""

    agent_registration_id: str
    """The agent registration that was moved."""
    from_organization_id: str
    """The agent-created organization the registration is moving off of. Migrate its resources to `to_organization_id`, then delete it."""
    to_organization_id: str
    """The organization the registration now belongs to."""

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

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