package resmon

// GetByComputeData represents an array of data points
type GetByComputeData []GetByComputePoint

type GetByComputePoint struct {
	ID        uint64       `json:"id"`
	Name      string       `json:"name"`
	ComputeID uint64       `json:"computeId"`
	AccountID uint64       `json:"accountId"`
	RGID      uint64       `json:"rgId"`
	Usage     ComputeUsage `json:"usage"`
	Disks     []ItemDisk   `json:"disks"`
	UID       string       `json:"uid"`
	NodeID    uint64       `json:"nodeId"`
}

type ComputeUsage struct {
	VCPUsConsumed   uint64  `json:"vcpusConsumed"`
	Storage         uint64  `json:"storage"`
	CPUTime         float64 `json:"cpuTime"`
	ExtIPs          uint64  `json:"extips"`
	RAMConsumed     uint64  `json:"ramConsumed"`
	VCPUsReserved   uint64  `json:"vcpusReserved"`
	IsUp            bool    `json:"isUp"`
	RAMConsumedReal float64 `json:"ramConsumedReal"`
	RAMReserved     uint64  `json:"ramReserved"`
}

type ItemDisk struct {
	ID            uint64  `json:"id"`
	Pool          string  `json:"pool"`
	ResID         string  `json:"resId"`
	SizeUsed      float64 `json:"sizeUsed"`
	SizeAvailable float64 `json:"sizeAvailable"`
	SizeMax       uint64  `json:"sizeMax"`
}

// GetByGRIDData represents an array of data points
type GetByGRIDData []GetByGRIDPoint

type GetByGRIDPoint struct {
	UID      string                 `json:"uid"`
	Total    ItemTotalByGRID        `json:"total"`
	Storages map[string]ItemStorage `json:"storages"`
}

type ItemTotalByGRID struct {
	CPUPower    float64 `json:"cpuPower"`
	CPUUtil     float64 `json:"cpuUtil"`
	TotalMem    float64 `json:"totalMem"`
	ReservedMem float64 `json:"reservedMem"`
	UsedMem     float64 `json:"usedMem"`
	FreeMem     float64 `json:"freeMem"`
}

type ItemStorage struct {
	UsedGiB  uint64 `json:"usedGiB"`
	TotalGiB uint64 `json:"totalGiB"`
}

// GetByNodeData represents an array of data points
type GetByNodeData []GetByNodePoint

type GetByNodePoint struct {
	Usage      NodeUsage     `json:"usage"`
	CPUInfo    CPUinfoByNode `json:"cpuInfo"`
	Name       string        `json:"name"`
	ID         uint64        `json:"id"`
	UID        string        `json:"uid"`
	TotalVCPUs uint64        `json:"total_vcpus"`
}

type NodeUsage struct {
	CPUPower    uint64  `json:"cpuPower"`
	UsedVCPUs   uint64  `json:"usedVcpus"`
	PCPU        float64 `json:"pcpu"`
	UsedMem     uint64  `json:"usedMem"`
	CPUUtil     float64 `json:"cpuUtil"`
	ReservedMem uint64  `json:"reservedMem"`
	FreeMem     uint64  `json:"freeMem"`
}

type CPUinfoByNode struct {
	ClockSpeed             uint64   `json:"clockSpeed"`
	CoreCount              uint64   `json:"coreCount"`
	PhysCount              uint64   `json:"physCount"`
	ThreadCount            uint64   `json:"threadCount"`
	ModelName              string   `json:"model_name"`
	Flags                  []string `json:"flags"`
	MaxSupportedGeneration string   `json:"max_supported_generation"`
}
