package grid

// Resource information
type Resources struct {
	// Current resources
	Current RecordResource `json:"Current"`

	// Reserved resources
	Reserved RecordResource `json:"Reserved"`
}

// Resource consumption information
type RecordResourcesConsumption struct {
	// Current resources
	Consumed RecordResource `json:"Consumed"`

	// Reserved resources
	Reserved RecordResource `json:"Reserved"`

	// GID
	GID uint64 `json:"id"`
}

type ListResourceConsumption struct {
	// Data
	Data []RecordResourcesConsumption `json:"data"`

	// Entry count
	EntryCount uint64 `json:"entryCount"`
}

// Resource details
type RecordResource struct {
	// Number of CPU
	CPU uint64 `json:"cpu"`

	// Disk size
	DiskSize float64 `json:"disksize"`

	// Disk size max
	DiskSizeMax int64 `json:"disksizemax"`

	// External IPs
	ExtIPs uint64 `json:"extips"`

	// Number of GPU
	GPU uint64 `json:"gpu"`

	// Number of RAM
	RAM uint64 `json:"ram"`

	// SEPs
	SEPs map[string]map[string]DiskUsage `json:"seps"`
}

// Disk usage
type DiskUsage struct {
	// Disk size
	DiskSize float64 `json:"disksize"`

	// Disk size max
	DiskSizeMax float64 `json:"disksizemax"`
}

// Detailed information about grid
type RecordGrid struct {
	// CKey
	CKey string `json:"_ckey"`

	// Meta
	Meta []interface{} `json:"_meta"`

	// AuthBroker
	AuthBroker []interface{} `json:"authBroker"`

	// Flag
	Flag string `json:"flag"`

	// Grid ID
	GID uint64 `json:"gid"`

	// GUID
	GUID uint64 `json:"guid"`

	// ID
	ID uint64 `json:"id"`

	// Location code
	LocationCode string `json:"locationCode"`

	// Name
	Name string `json:"name"`

	// Network modes
	NetworkModes []string `json:"network_modes"`

	// SDN support
	SDNSupport bool `json:"sdn_support"`

	// Is BRO enabled
	BROEnabled bool `json:"bro_enabled"`
}

// Information about grid
type ItemGridList struct {
	// Resource information
	Resources Resources `json:"Resources"`

	// AuthBroker
	AuthBroker []interface{} `json:"authBroker"`

	// Flag
	Flag string `json:"flag"`

	// Grid ID
	GID uint64 `json:"gid"`

	// GUID
	GUID uint64 `json:"guid"`

	// ID
	ID uint64 `json:"id"`

	// Location code
	LocationCode string `json:"locationCode"`

	// Name
	Name string `json:"name"`

	// Network modes
	NetworkModes []string `json:"network_modes"`

	// SDN support
	SDNSupport bool `json:"sdn_support"`

	// Is Zero Access enabled
	ZeroAccessEnabled bool `json:"zeroaccess_enabled"`

	// Is BRO enabled
	BROEnabled bool `json:"bro_enabled"`
}

// List Grids
type ListGrids struct {
	//Data
	Data []ItemGridList `json:"data"`

	// Entry count
	EntryCount uint64 `json:"entryCount"`
}

// List emails
type ListEmails struct {
	//Data
	Data []string `json:"data"`

	// Entry count
	EntryCount uint64 `json:"entryCount"`
}

// Detailed information about grid settings
type RecordSettingsGrid struct {
	//Allowed ports
	Allowedports []int `json:"allowedports"`

	//Cleanup retention period
	CleanupRetentionPeriod uint64 `json:"cleanupRetentionPeriod"`

	//Docker registry
	DockerRegistry DockerRegistry `json:"docker_registry"`

	//Enable uptime monitor
	EnableUptimeMonitor bool `json:"enableUptimeMonitor"`

	//Extnet max prereservation num
	ExtnetMaxPreReservationsNum int `json:"extnetMaxPreReservationsNum"`

	//Healthcheck notifications
	HealthcheckNotifications HealthcheckNotifications `json:"healthcheck_notifications"`

	//k8s cleanup enabled
	K8sCleanupEnabled bool `json:"k8s_cleanup_enabled"`

	//Limits
	Limits interface{} `json:"limits"`

	//Location url
	LocationURL string `json:"location_url"`

	//Net QOS
	NetQOS NetQOS `json:"net_qos"`

	//Networks
	Networks string `json:"networks"`

	//Prometheus
	Prometheus Prometheus `json:"prometheus"`

	//Vins max prereservation num
	VinsMaxPreReservationsNum int `json:"vinsMaxPreReservationsNum"`

	//Vnfdev mgmt net range
	VnfdevMgmtNetRange string `json:"vnfdev_mgmt_net_range"`
}

// DockerRegistry in grid settings
type DockerRegistry struct {
	//Password
	Password string `json:"password"`

	//Server
	Server string `json:"server"`

	//Username
	Username string `json:"username"`
}

// NetQOS in grid settings
type NetQOS struct {
	// ExtNet Net QOS settings
	ExtNet SettingsNetQOS `json:"ext_net"`

	// VINS Net QOS settings
	VINS SettingsNetQOS `json:"vins"`
}

// SettingsNetQOS in grid settings
type SettingsNetQOS struct {
	//ERate
	ERate uint64 `json:"eRate"`

	//InBurst
	InBurst uint64 `json:"inBurst"`

	//InRate
	InRate uint64 `json:"inRate"`
}

// HealthcheckNotifications settings in grid
type HealthcheckNotifications struct {
	//Emails
	Emails []Emails `json:"emails"`
}

type Emails struct {
	//Address
	Address string `json:"address"`

	//Enabled
	Enabled bool `json:"enabled"`
}

// Prometheus setting in grid
type Prometheus struct {
	//ScrapeInterval
	ScrapeInterval int `json:"scrapeInterval"`
}
