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

from __future__ import annotations

from dataclasses import dataclass
from typing import Any, Literal

from workos._types import _raise_deserialize_error


@dataclass(slots=True)
class RedirectUri:
    """Redirect Uri model."""

    object: Literal["redirect_uri"]
    """The object type."""
    id: str
    """The ID of the redirect URI."""
    uri: str
    """The redirect URI."""
    default: bool
    """Whether this is the default redirect URI."""
    created_at: str
    """The timestamp when the redirect URI was created."""
    updated_at: str
    """The timestamp when the redirect URI was last updated."""

    @classmethod
    def from_dict(cls, data: dict[str, Any]) -> RedirectUri:
        """Deserialize from a dictionary."""
        try:
            return cls(
                object=data.get("object", "redirect_uri"),
                id=data["id"],
                uri=data["uri"],
                default=data["default"],
                created_at=data["created_at"],
                updated_at=data["updated_at"],
            )
        except (KeyError, ValueError) as e:
            _raise_deserialize_error("RedirectUri", 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["uri"] = self.uri
        result["default"] = self.default
        result["created_at"] = self.created_at
        result["updated_at"] = self.updated_at
        return result
