from typing import Optional

from pydantic import BaseModel


class GZEndpointItem(BaseModel):
    id: str
    name: str
    fqdn: Optional[str] = None
    ip: Optional[str] = None
    os_version: Optional[str] = None
    is_managed: bool
    policy_name: Optional[str] = None


class GZEndpointDetail(BaseModel):
    id: str
    name: str
    company_id: Optional[str] = None
    infected: bool
    detection_active: bool
    signature_outdated: bool
    product_outdated: bool
    agent_version: Optional[str] = None
    engine_version: Optional[str] = None
    last_seen: Optional[str] = None
    last_update: Optional[str] = None
    state: int
    modules: Optional[dict] = None


class GZCompanyItem(BaseModel):
    id: str
    name: str
    type: int


class GZSweepResult(BaseModel):
    total: int
    infected: int
    signature_outdated: int
    product_outdated: int
    not_seen_recently: int
    endpoints: list[dict]


class GZStatusResponse(BaseModel):
    enabled_apis: list[str]
    key_created_at: Optional[str] = None
    used_slots: Optional[int] = None
    total_slots: Optional[int] = None
    expiry_date: Optional[str] = None
