# 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 UpdateAuthorizationPermission:
    """Update Authorization Permission model."""

    name: Optional[str] = None
    """A descriptive name for the Permission."""
    description: Optional[str] = None
    """An optional description of the Permission."""

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

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