# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations
from typing import Any

from pydantic import BaseModel, ConfigDict, Field


class GRPCFrameworkConfig(BaseModel):
    """
    gRPC framework configuration details.

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

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

    enabled: bool = Field(description='Whether framework is enabled')
    auto_discover: bool = Field(description='Auto-discover services')
    services_path: str = Field(description='Services discovery path pattern')
    interceptors: list[str] | None = Field(None, description='Registered interceptors')



class GRPCServerConfig(BaseModel):
    """
    gRPC server configuration details.

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

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

    host: str = Field(description='Server host address')
    port: int = Field(description='Server port')
    enabled: bool = Field(description='Whether gRPC server is enabled')
    max_concurrent_streams: int | None = Field(
    None,
    description='Maximum concurrent streams (asyn...',
)
    max_concurrent_rpcs: int | None = Field(None, description='Maximum concurrent RPCs')



class GRPCFeatures(BaseModel):
    """
    gRPC features configuration.

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

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

    api_key_auth: bool = Field(description='API key authentication enabled')
    request_logging: bool = Field(description='Request logging enabled')
    metrics: bool = Field(description='Metrics collection enabled')
    reflection: bool = Field(description='gRPC reflection enabled')



class GRPCConfig(BaseModel):
    """
    Complete gRPC configuration response.

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

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

    server: GRPCServerConfig = ...
    framework: GRPCFrameworkConfig = ...
    features: GRPCFeatures = ...
    registered_services: int = Field(description='Number of registered services')
    total_methods: int = Field(description='Total number of methods')



class GRPCInterceptorInfo(BaseModel):
    """
    Information about an interceptor.

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

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

    name: str = Field(description='Interceptor name')
    enabled: bool = Field(description='Whether interceptor is enabled')



class GRPCStats(BaseModel):
    """
    Runtime statistics summary.

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

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

    total_requests: int = Field(description='Total number of requests')
    success_rate: float = Field(description='Success rate percentage')
    avg_duration_ms: float = Field(description='Average duration in milliseconds')



class GRPCServiceInfo(BaseModel):
    """
    Information about a single gRPC service.

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

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

    name: str = Field(description='Service name')
    methods: list[str] | None = Field(None, description='Service methods')
    full_name: str = Field(description='Full service name with package')
    description: str | None = Field(None, description='Service description')



class GRPCServerInfo(BaseModel):
    """
    Complete gRPC server information response.

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

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

    server_status: str = Field(description='Server status (running, stopped)')
    address: str = Field(description='Server address (host:port)')
    started_at: str | None = Field(None, description='Server start timestamp')
    uptime_seconds: int | None = Field(None, description='Server uptime in seconds')
    services: list[GRPCServiceInfo] | None = Field(None, description='Registered services')
    interceptors: list[GRPCInterceptorInfo] | None = Field(None, description='Active interceptors')
    stats: GRPCStats = ...



