# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations
from typing import Any

from pydantic import BaseModel, ConfigDict, Field


class CentrifugoChannelsRequestRequest(BaseModel):
    """
    Request to list active channels.

    Request model (no read-only fields).
    """

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

    pattern: str | None = Field(None, description='Pattern to filter channels (e.g....')



class CentrifugoChannelsResult(BaseModel):
    """
    Channels result wrapper.

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

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

    channels: dict[str, Any] = Field(description='Map of channel names to channel ...')



class CentrifugoError(BaseModel):
    """
    Centrifugo API error structure.

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

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

    code: int | None = Field(None, description='Error code (0 = no error)')
    message: str | None = Field(None, description='Error message')



class CentrifugoChannelsResponse(BaseModel):
    """
    List of active channels response.

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

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

    error: CentrifugoError | None = None
    result: CentrifugoChannelsResult | None = None



class CentrifugoStreamPosition(BaseModel):
    """
    Stream position for pagination.

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

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

    offset: int = Field(description='Stream offset')
    epoch: str = Field(description='Stream epoch')



class CentrifugoHistoryRequestRequest(BaseModel):
    """
    Request to get channel history.

    Request model (no read-only fields).
    """

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

    channel: str = Field(description='Channel name')
    limit: int | None = Field(None, description='Maximum number of messages to re...')
    since: CentrifugoStreamPosition | None = None
    reverse: bool | None = Field(None, description='Reverse message order (newest fi...')



class CentrifugoClientInfo(BaseModel):
    """
    Information about connected client.

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

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

    user: str = Field(description='User ID')
    client: str = Field(description='Client UUID')
    conn_info: dict[str, Any] | None = Field(None, description='Connection metadata')
    chan_info: dict[str, Any] | None = Field(None, description='Channel-specific metadata')



class CentrifugoPublication(BaseModel):
    """
    Single publication (message) in channel history.

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

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

    data: dict[str, Any] = Field(description='Message payload')
    info: CentrifugoClientInfo | None = None
    offset: int = Field(description='Message offset in channel stream')
    tags: dict[str, Any] | None = Field(None, description='Optional message tags')



class CentrifugoHistoryResult(BaseModel):
    """
    History result wrapper.

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

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

    publications: list[CentrifugoPublication] = Field(description='List of publications')
    epoch: str = Field(description='Current stream epoch')
    offset: int = Field(description='Latest stream offset')



class CentrifugoHistoryResponse(BaseModel):
    """
    Channel history response.

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

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

    error: CentrifugoError | None = None
    result: CentrifugoHistoryResult | None = None



class CentrifugoProcess(BaseModel):
    """
    Process information.

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

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

    cpu: float = Field(description='CPU usage percentage')
    rss: int = Field(description='Resident set size in bytes')



class CentrifugoMetrics(BaseModel):
    """
    Server metrics.

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

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

    interval: float = Field(description='Metrics collection interval')
    items: dict[str, Any] = Field(description='Metric name to value mapping')



class CentrifugoNodeInfo(BaseModel):
    """
    Information about a single Centrifugo node.

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

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

    uid: str = Field(description='Unique node identifier')
    name: str = Field(description='Node name')
    version: str = Field(description='Centrifugo version')
    num_clients: int = Field(description='Number of connected clients')
    num_users: int = Field(description='Number of unique users')
    num_channels: int = Field(description='Number of active channels')
    uptime: int = Field(description='Node uptime in seconds')
    num_subs: int = Field(description='Total number of subscriptions')
    metrics: CentrifugoMetrics | None = None
    process: CentrifugoProcess | None = None



class CentrifugoInfoResult(BaseModel):
    """
    Info result wrapper.

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

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

    nodes: list[CentrifugoNodeInfo] = Field(description='List of Centrifugo nodes')



class CentrifugoInfoResponse(BaseModel):
    """
    Server info response.

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

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

    error: CentrifugoError | None = None
    result: CentrifugoInfoResult | None = None



class CentrifugoPresenceRequestRequest(BaseModel):
    """
    Request to get channel presence.

    Request model (no read-only fields).
    """

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

    channel: str = Field(description='Channel name')



class CentrifugoPresenceResult(BaseModel):
    """
    Presence result wrapper.

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

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

    presence: dict[str, Any] = Field(description='Map of client IDs to client info')



class CentrifugoPresenceResponse(BaseModel):
    """
    Channel presence response.

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

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

    error: CentrifugoError | None = None
    result: CentrifugoPresenceResult | None = None



class CentrifugoPresenceStatsRequestRequest(BaseModel):
    """
    Request to get channel presence statistics.

    Request model (no read-only fields).
    """

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

    channel: str = Field(description='Channel name')



class CentrifugoPresenceStatsResult(BaseModel):
    """
    Presence stats result.

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

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

    num_clients: int = Field(description='Number of connected clients')
    num_users: int = Field(description='Number of unique users')



class CentrifugoPresenceStatsResponse(BaseModel):
    """
    Channel presence stats response.

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

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

    error: CentrifugoError | None = None
    result: CentrifugoPresenceStatsResult | None = None



