# 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 AddRolePermission:
    """Add Role Permission model."""

    slug: str
    """The slug of the permission to add to the role."""

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

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