# 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 ConnectionActivatedDataDomain:
    """Connection Activated Data Domain model."""

    object: Literal["connection_domain"]
    """Distinguishes the connection domain object."""
    id: str
    """Unique identifier of the connection domain."""
    domain: str
    """The domain value."""

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

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