# 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 GroupRoleAssignmentResource:
    """The resource the role is assigned on."""

    id: str
    """The unique ID of the Resource."""
    external_id: str
    """An identifier you provide to reference the resource in your system."""
    resource_type_slug: str
    """The slug of the resource type this resource belongs to."""

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

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