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

from __future__ import annotations

from dataclasses import dataclass
from typing import Any

from workos._types import _raise_deserialize_error


@dataclass(slots=True)
class CreateCORSOrigin:
    """Create CORS Origin model."""

    origin: str
    """The origin URL to allow for CORS requests."""

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

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