# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .api_key_scope_role import ApiKeyScopeRole


class ApiKeyScope(UniversalBaseModel):
    """
    Scope definition for an API key - defines resource and role access.
    """

    resource_id: str = pydantic.Field()
    """
    ID of the resource.
    """

    resource_type: str = pydantic.Field()
    """
    Type of resource (namespace, project, agent).
    """

    role: ApiKeyScopeRole = pydantic.Field()
    """
    Role for this resource.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
