"""Role schemas."""

from __future__ import annotations

from typing import Any

from pydantic import BaseModel, Field


class RoleCreate(BaseModel):
    name: str = Field(..., min_length=1, max_length=100)
    permissions: dict[str, Any] = Field(default_factory=dict)
    denied_permissions: list[str] = Field(default_factory=list)
    field_permissions: dict[str, Any] = Field(default_factory=dict)


class RoleUpdate(BaseModel):
    name: str | None = None
    permissions: dict[str, Any] | None = None
    denied_permissions: list[str] | None = None
    field_permissions: dict[str, Any] | None = None


class RoleResponse(BaseModel):
    id: str
    name: str
    permissions: dict[str, Any]
    denied_permissions: list[str] = Field(default_factory=list)
    field_permissions: dict[str, Any]
    permission_version: int = 1
