# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations
from typing import Any

from pydantic import BaseModel, ConfigDict, Field

from ..enums import StatCardChangeType


class ModelStatistics(BaseModel):
    """
    Serializer for individual model statistics.

    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    model_name: str = Field(description='Model name (key)')
    name: str = Field(description='Model verbose name')
    count: int = Field(description='Number of records in this model')
    fields_count: int = Field(description='Number of fields in model')
    admin_url: str = Field(description='Django admin URL name')



class AppStatisticsData(BaseModel):
    """
    Serializer for application statistics data.

    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    name: str = Field(description='Human-readable app name')
    models: list[ModelStatistics] = Field(description='List of model statistics')
    total_records: int = Field(description='Total records count')
    model_count: int = Field(description='Number of models')



class AppStatistics(BaseModel):
    """
    Serializer for application-specific statistics.

    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    app_name: str = Field(description='Application name')
    statistics: AppStatisticsData = ...



class StatCard(BaseModel):
    """
    Serializer for dashboard statistics cards. Maps to StatCard Pydantic model.

    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    title: str = Field(description='Card title')
    value: str = Field(description='Main value to display')
    icon: str = Field(description='Material icon name')
    change: str | None = Field(None, description="Change indicator (e.g., '+12%')")
    change_type: StatCardChangeType | None = Field(
    None,
    description='Change type  * `positive` - posi...',
)
    description: str | None = Field(None, description='Additional description')
    color: str | None = Field(None, description='Card color theme')



class UserStatistics(BaseModel):
    """
    Serializer for user statistics.

    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    total_users: int = Field(description='Total number of users')
    active_users: int = Field(description='Active users (last 30 days)')
    new_users: int = Field(description='New users (last 7 days)')
    superusers: int = Field(description='Number of superusers')



