package view

import "github.com/pingcap-inc/clinic/pkg/db"

type DashboardItemInternal struct {
	TenantID            string `json:"tenantID"`
	TenantName          string `json:"tenantName"`
	ClusterID           string `json:"clusterID"`
	ClusterName         string `json:"clusterName"`
	ClusterCreatedAt    int64  `json:"clusterCreatedAt"`
	ClusterDuration     string `json:"clusterDuration"`
	ClusterDeletedAt    int64  `json:"clusterDeletedAt"`
	ClusterStatus       string `json:"clusterStatus"`
	ClusterDeployType   string `json:"clusterDeployType"`
	ClusterDeployTypeV2 string `json:"clusterDeployTypeV2"`
}

type DashboardItemExternal struct {
	*DashboardItemInternal
	ClusterRowID         uint         `json:"-"`
	ClusterVersion       string       `json:"clusterVersion"`
	ClusterRegionName    string       `json:"clusterRegionName"`
	ClusterProviderName  string       `json:"clusterProviderName"`
	ClusterShootName     string       `json:"clusterShootName"`
	ClusterK8sNamespace  string       `json:"clusterK8sNamespace"`
	ClusterNetworkName   string       `json:"clusterNetworkName"`
	ClusterDataPlaneName string       `json:"clusterDataPlaneName"`
	ClusterType          string       `json:"clusterType"`
	TenantPlan           string       `json:"tenantPlan"`
	ProjectID            string       `json:"projectID"`
	ParentID             string       `json:"parentID"`
	OrgID                string       `json:"orgID"`
	ControlPlaneArch     string       `json:"controlPlaneArch"`
	Topology             *db.Topology `json:"topology"`
}

type DashboardTotal struct {
	Total int `json:"total"`
}

type ListClusterFilter struct {
	OrgID              uint
	ProjectID          uint
	Query              string
	HideDeleted        bool
	HideServerlessTier bool
}

type ListOrganizationAndClusterFilter struct {
	Query            string
	ClusterIDs       []string
	ClusterStatus    []string
	Version          []string
	DeployType       []string
	DeployTypeV2     []string
	TenantPlan       []string
	ControlPlaneArch []string
	Provider         []string
	Region           []string
	Sort             string
	Order            string
	Hide_deleted     bool
	CreatedAtFrom    int64
	CreatedAtTo      int64
	DeletedAtFrom    int64
	DeletedAtTo      int64
}

type ComponentType string

type ResourcePoolComponent struct {
	// id means the component group id
	Id            string        `json:"id"`
	ComponentType ComponentType `json:"component_type"`
	CpuNum        uint32        `json:"cpu"`
	MemoryGi      uint32        `json:"memory_gi"`
	NodeCount     uint32        `json:"node_count"`
	MaxNodeCount  uint32        `json:"max_node_count"`
	MinNodeCount  uint32        `json:"min_node_count"`
	// include storage and tikv additional storage
	Storages []*ResourcePoolStorage `json:"storages"`
	Version  string                 `json:"version"`
	Phase    string                 `json:"phase"`
	Image    *ResourcePoolImage     `json:"image,omitempty"`
}

// ResourcePoolImage mirrors nextgen component configuration imageRepo / imageTag.
type ResourcePoolImage struct {
	Repo string `json:"repo,omitempty"`
	Tag  string `json:"tag,omitempty"`
}

type ResourcePoolStorage struct {
	// the storage name
	Name string `json:"name,omitempty"`
	// the storage type
	// aws s3/io2 or gcp gcs
	// or azure blob
	Type string `json:"type,omitempty"`
	// the storage size
	SizeGi uint32 `json:"size_gi,omitempty"`
	// the storage iops
	Iops uint32 `json:"iops,omitempty"`
	// the storage throughput
	ThroughputMbs uint32 `json:"throughput_mbs,omitempty"`
}
