package monitor

import "time"

type MonitorBase struct {
	ID        uint      `xorm:"id" json:"id"`
	CreatedAt time.Time `xorm:"created_at" json:"createdAt"`
	UpdatedAt time.Time `xorm:"updated_at" json:"updatedAt"`

	Cpu float64 `xorm:"cpu" json:"cpu"`

	LoadUsage float64 `xorm:"load_usage" json:"loadUsage"`
	CpuLoad1  float64 `xorm:"cpu_load1" json:"cpuLoad1"`
	CpuLoad5  float64 `xorm:"cpu_load5" json:"cpuLoad5"`
	CpuLoad15 float64 `xorm:"cpu_load15" json:"cpuLoad15"`

	Memory float64 `xorm:"memory" json:"memory"`

	DbSize uint `xorm:"db_size" json:"dbSize"`
}

type MonitorIO struct {
	ID        uint      `xorm:"id" json:"id"`
	CreatedAt time.Time `xorm:"created_at" json:"createdAt"`
	UpdatedAt time.Time `xorm:"updated_at" json:"updatedAt"`

	Name  string `xorm:"name" json:"name"`
	Read  uint64 `xorm:"read" json:"read"`
	Write uint64 `xorm:"write" json:"write"`
	Count uint64 `xorm:"count" json:"count"`
	Time  uint64 `xorm:"time" json:"time"`
}

type MonitorNetwork struct {
	ID        uint      `xorm:"id" json:"id"`
	CreatedAt time.Time `xorm:"created_at" json:"createdAt"`
	UpdatedAt time.Time `xorm:"updated_at" json:"updatedAt"`

	Name string  `xorm:"name" json:"name"`
	Up   float64 `xorm:"up" json:"up"`
	Down float64 `xorm:"down" json:"down"`
}

type MonitorSearch struct {
	Param     string    `json:"param" validate:"required,oneof=all cpu memory load io network"`
	Info      string    `json:"info"`
	StartTime time.Time `json:"startTime"`
	EndTime   time.Time `json:"endTime"`
}

type MonitorData struct {
	Param string        `json:"param" validate:"required,oneof=cpu memory load io network"`
	Date  []time.Time   `json:"date"`
	Value []interface{} `json:"value"`
}
