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

from __future__ import annotations

from dataclasses import dataclass
from typing import Any, Dict, Optional
from workos._types import _raise_deserialize_error


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

    uri: str
    """The redirect URI."""
    default: Optional[bool] = None
    """Whether this is the default redirect URI."""

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

    def to_dict(self) -> Dict[str, Any]:
        """Serialize to a dictionary."""
        result: Dict[str, Any] = {}
        result["uri"] = self.uri
        if self.default is not None:
            result["default"] = self.default
        else:
            result["default"] = None
        return result
