"""AccessRequest model — fully typed request context for evaluation."""

from typing import Any

from pydantic import BaseModel

from pyauthz.models.resource import Resource
from pyauthz.models.subject import Subject


class AccessRequest(BaseModel):
    """Fully typed request context for policy evaluation.

    Bundles the subject, action, resource, and environment into a single
    object that the engine evaluates against policies.

    Example:
        request = AccessRequest(
            subject=Subject(id="alice", roles=["editor"]),
            action="documents:write",
            resource=Resource(id="doc-1", type="documents", owner_id="alice"),
            environment={"hour": 14, "ip": "10.0.0.1"},
        )
    """

    subject: Subject
    action: str
    resource: Resource
    environment: dict[str, Any] = {}
