package main

// Types transcribed from preseem/preseem.yaml (components.schemas).
// Only fields useful for read flows are modeled; the raw JSON body is
// always available via --json passthrough for anything not listed here.

type Paginator struct {
	Page       int `json:"page"`
	PageCount  int `json:"page_count"`
	Limit      int `json:"limit"`
	TotalCount int `json:"total_count"`
}

type AccessPoint struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Tower     string `json:"tower"`
	IPAddress string `json:"ip_address"`
}

type AccessPointList struct {
	Data      []AccessPoint `json:"data"`
	Paginator Paginator     `json:"paginator"`
}

type APShaperRate struct {
	UpSpeed   int64 `json:"up_speed,omitempty"`
	DownSpeed int64 `json:"down_speed,omitempty"`
	Activate  bool  `json:"activate,omitempty"`
}

type SNMP3 struct {
	SecurityName string `json:"security_name,omitempty"`
	AuthKey      string `json:"auth_key,omitempty"`
	AuthProtocol string `json:"auth_protocol,omitempty"`
	PrivKey      string `json:"priv_key,omitempty"`
	PrivProtocol string `json:"priv_protocol,omitempty"`
}

type AccessPointConfig struct {
	ShaperRate    *APShaperRate `json:"shaper_rate,omitempty"`
	SNMPCommunity string        `json:"snmp_community,omitempty"`
	SNMP3         *SNMP3        `json:"snmp3,omitempty"`
}

// Score endpoints are field-heavy and don't paginate per spec — they
// return a top-level array.
// NB: the spec types numerics as `integer` but the live API returns
// floats for latency/throughput/scores. Use float64 throughout so
// decoding never breaks; printers round for display.
type AccessPointScore struct {
	Name              string  `json:"name"`
	Status            string  `json:"status"`
	SiteName          string  `json:"site_name"`
	ManufacturerName  string  `json:"manufacturer_name"`
	ModelName         string  `json:"model_name"`
	ManagementIP      string  `json:"management_ip"`
	SystemMacAddress  string  `json:"system_mac_address"`
	Connections       float64 `json:"connections"`
	Latency           float64 `json:"latency"`
	ThroughputTX      float64 `json:"throughput_tx"`
	ThroughputRX      float64 `json:"throughput_rx"`
	Frequency         float64 `json:"frequency"`
	ChannelWidth      float64 `json:"channel_width"`
	Firmware          string  `json:"firmware"`
	RFScore           float64 `json:"rf_score"`
	RFScoreSeverity   any     `json:"rf_score_severity"`
	APHealthScore     float64 `json:"ap_health_score"`
	APHealthSeverity  string  `json:"ap_health_score_severity"`
	SubscriberCap     float64 `json:"subscriber_capacity"`
	SubscriberCapSev  string  `json:"subscriber_capacity_severity"`
	SliceCondition    string  `json:"slice_condition"`
	LatencySeverity   string  `json:"latency_severity"`
	ModelSupportLvl   string  `json:"model_support_level"`
	AirtimeRemTX      float64 `json:"airtime_remaining_tx"`
	AirtimeRemSevTX   string  `json:"airtime_remaining_severity_tx"`
	RFScoreTrend      string  `json:"rf_score_trend"`
	APHealthTrend     string  `json:"ap_health_score_trend"`
	SubscriberCapTrnd string  `json:"subscriber_capacity_trend"`
	SerialNumber      string  `json:"serial_number"`
	ElementID         int     `json:"element_id"`
}

type CPERadioScore struct {
	Name             string  `json:"name"`
	Status           string  `json:"status"`
	APName           string  `json:"ap_name"`
	APSiteName       string  `json:"ap_site_name"`
	ManufacturerName string  `json:"manufacturer_name"`
	ModelName        string  `json:"model_name"`
	ManagementIP     string  `json:"management_ip"`
	SystemMacAddress string  `json:"system_mac_address"`
	Firmware         string  `json:"firmware"`
	Frequency        float64 `json:"frequency"`
	ChannelWidth     float64 `json:"channel_width"`
	RFScore          float64 `json:"rf_score"`
	RFScoreSeverity  any     `json:"rf_score_severity"`
	RFScoreTrend     string  `json:"rf_score_trend"`
	BusinessValue    float64 `json:"business_value_score"`
	BusinessValueSev string  `json:"business_value_score_severity"`
	SliceCondition   string  `json:"slice_condition"`
	SerialNumber     string  `json:"serial_number"`
	ElementID        int     `json:"element_id"`
	APID             int     `json:"ap_id"`
}

type Account struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type AccountList struct {
	Data      []Account `json:"data"`
	Paginator Paginator `json:"paginator"`
}

type Package struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	UpSpeed   int64  `json:"up_speed,omitempty"`
	DownSpeed int64  `json:"down_speed,omitempty"`
}

type PackageList struct {
	Data      []Package `json:"data"`
	Paginator Paginator `json:"paginator"`
}

type ServiceAttachment struct {
	CPEMac          string   `json:"cpe_mac,omitempty"`
	NetworkPrefixes []string `json:"network_prefixes,omitempty"`
	CPESerial       string   `json:"cpe_serial,omitempty"`
	CPEIMSI         string   `json:"cpe_imsi,omitempty"`
	Username        string   `json:"username,omitempty"`
}

type Service struct {
	ID             string              `json:"id"`
	Attachments    []ServiceAttachment `json:"attachments,omitempty"`
	UpSpeed        int64               `json:"up_speed,omitempty"`
	DownSpeed      int64               `json:"down_speed,omitempty"`
	Account        string              `json:"account"`
	Package        string              `json:"package,omitempty"`
	ParentDeviceID string              `json:"parent_device_id,omitempty"`
}

type ServiceList struct {
	Data      []Service `json:"data"`
	Paginator Paginator `json:"paginator"`
}

type Router struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Site string `json:"site"`
	Host string `json:"host"`
}

type RouterList struct {
	Data      []Router  `json:"data"`
	Paginator Paginator `json:"paginator"`
}

type OLT struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Site string `json:"site"`
	Host string `json:"host"`
}

type OLTList struct {
	Data      []OLT     `json:"data"`
	Paginator Paginator `json:"paginator"`
}

type SiteAttachment struct {
	NetworkPrefixes []string `json:"network_prefixes,omitempty"`
}

type Site struct {
	ID         string          `json:"id"`
	Name       string          `json:"name"`
	Attachment *SiteAttachment `json:"attachment,omitempty"`
}

type SiteList struct {
	Data      []Site    `json:"data"`
	Paginator Paginator `json:"paginator"`
}
