# generated by datamodel-codegen:
#   filename:  Cpty/CptyStatus.json

from __future__ import annotations

from typing import Annotated, Dict, Optional

from msgspec import Meta, Struct

from .. import definitions


class CptyStatus(Struct, omit_defaults=True):
    connected: bool
    connections: Dict[str, definitions.ConnectionStatus]
    kind: str
    stale: bool
    instance: Optional[str] = None
    logged_in: Optional[
        Annotated[Optional[bool], Meta(description="Not applicable to cpty if None")]
    ] = None
    """
    Not applicable to cpty if None
    """

    # Constructor that takes all field titles as arguments for convenience
    @classmethod
    def new(
        cls,
        connected: bool,
        connections: Dict[str, definitions.ConnectionStatus],
        kind: str,
        stale: bool,
        instance: Optional[str] = None,
        logged_in: Optional[bool] = None,
    ):
        return cls(
            connected,
            connections,
            kind,
            stale,
            instance,
            logged_in,
        )

    def __str__(self) -> str:
        return f"CptyStatus(connected={self.connected},connections={self.connections},kind={self.kind},stale={self.stale},instance={self.instance},logged_in={self.logged_in})"
