# 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 CreateOrganizationDomain:
    """Create Organization Domain model."""

    domain: str
    """The domain to add to the organization."""
    organization_id: str
    """The ID of the organization to add the domain to."""

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

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