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         uint64 `json:"cpuTime"`
	ExtIPs          uint64 `json:"extips"`
	RAMConsumed     uint64 `json:"ramConsumed"`
	VCPUsReserved   uint64 `json:"vcpusReserved"`
	IsUp            uint64 `json:"isUp"`
	RAMConsumedReal uint64 `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       float64 `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 {
	NodesCPU        uint64 `json:"nodesCPU"`
	StorageCapacity uint64 `json:"storageCapacity"`
	CPUPower        uint64 `json:"cpuPower"`
	CPUUtil         uint64 `json:"cpuUtil"`
	TotalMem        uint64 `json:"totalMem"`
	ReservedMem     uint64 `json:"reservedMem"`
	UsedMem         uint64 `json:"usedMem"`
	FreeMem         uint64 `json:"freeMem"`
	VCPUConsumed    uint64 `json:"vcpuConsumed"`
}

type ItemStorage struct {
	CapacityLimit uint64 `json:"capacityLimit"`
	Consumed      uint64 `json:"consumed"`
	Type          string `json:"type"`
	UID           string `json:"uid"`
}

// 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"`
}

type NodeUsage struct {
	CPUPower    uint64 `json:"cpuPower"`
	UsedVCPUs   uint64 `json:"usedVcpus"`
	PCPU        uint64 `json:"pcpu"`
	UsedMem     uint64 `json:"usedMem"`
	CPUUtil     uint64 `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"`
}
