# 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 AuthorizationCheck:
    """Authorization Check model."""

    authorized: bool
    """Whether the organization membership has the specified permission on the resource."""

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

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