"""Subject model — the entity requesting access."""

from typing import Any

from pydantic import BaseModel


class Subject(BaseModel):
    """The entity requesting access — user, service, API key, etc.

    A subject has an identity (id), zero or more roles, and optional
    freeform attributes for ABAC condition evaluation.

    Example:
        user = Subject(
            id="alice",
            roles=["editor", "viewer"],
            attributes={"department": "engineering"},
        )
    """

    id: str
    roles: list[str] = []
    attributes: dict[str, Any] = {}
