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

from __future__ import annotations

from typing import Annotated, Optional

from msgspec import Meta, Struct


class CptyStatus(Struct, omit_defaults=True):
    connected: bool
    kind: str
    last_heartbeat: Annotated[int, Meta(description="UNIX epoch time or -1 for never")]
    """
    UNIX epoch time or -1 for never
    """
    last_heartbeat_stale_threshold: Annotated[
        int, Meta(description="Stale threshold in seconds, or -1 for never stale")
    ]
    """
    Stale threshold in seconds, or -1 for never stale
    """
    logged_in: bool
    instance: Optional[str] = None

    # Constructor that takes all field titles as arguments for convenience
    @classmethod
    def new(
        cls,
        connected: bool,
        kind: str,
        last_heartbeat: int,
        last_heartbeat_stale_threshold: int,
        logged_in: bool,
        instance: Optional[str] = None,
    ):
        return cls(
            connected,
            kind,
            last_heartbeat,
            last_heartbeat_stale_threshold,
            logged_in,
            instance,
        )

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