package models

import (
	"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
	"github.com/hashicorp/terraform-plugin-framework/types"
)

type RecordK8SDataSourceModel struct {
	// request fields
	K8SID    types.Int64    `tfsdk:"k8s_id"`
	Timeouts timeouts.Value `tfsdk:"timeouts"`
	// response fields
	Id                types.String                  `tfsdk:"id"`
	ACL               *RecordACLDataSourceModel     `tfsdk:"acl"`
	AccountID         types.Int64                   `tfsdk:"account_id"`
	AccountName       types.String                  `tfsdk:"account_name"`
	BServiceID        types.Int64                   `tfsdk:"bservice_id"`
	K8CI              types.Int64                   `tfsdk:"k8sci_id"`
	CreatedBy         types.String                  `tfsdk:"created_by"`
	CreatedTime       types.Int64                   `tfsdk:"created_time"`
	DeletedBy         types.String                  `tfsdk:"deleted_by"`
	ExtnetOnly        types.Bool                    `tfsdk:"extnet_only"`
	HighlyAvailableLB types.Bool                    `tfsdk:"ha_mode"`
	K8SAddressVIP     *K8SAddressVIP                `tfsdk:"address_vip"`
	DeletedTime       types.Int64                   `tfsdk:"deleted_time"`
	Desc              types.String                  `tfsdk:"desc"`
	ExtNetID          types.Int64                   `tfsdk:"extnet_id"`
	K8CIName          types.String                  `tfsdk:"k8sci_name"`
	Masters           *MasterGroupDataSourceModel   `tfsdk:"masters"`
	Workers           []ItemK8SGroupDataSourceModel `tfsdk:"workers"`
	LBID              types.Int64                   `tfsdk:"lb_id"`
	LBIP              types.String                  `tfsdk:"lb_ip"`
	Name              types.String                  `tfsdk:"name"`
	NetworkPlugin     types.String                  `tfsdk:"network_plugin"`
	RGID              types.Int64                   `tfsdk:"rg_id"`
	RGName            types.String                  `tfsdk:"rg_name"`
	Status            types.String                  `tfsdk:"status"`
	TechStatus        types.String                  `tfsdk:"tech_status"`
	UpdatedBy         types.String                  `tfsdk:"updated_by"`
	UpdatedTime       types.Int64                   `tfsdk:"updated_time"`
	Kubeconfig        types.String                  `tfsdk:"kubeconfig"`
	VinsId            types.Int64                   `tfsdk:"vins_id"`
}

type K8SAddressVIP struct {
	BackendIP  types.String `tfsdk:"backend_ip"`
	FrontendIP types.String `tfsdk:"frontend_ip"`
}

type RecordACLDataSourceModel struct {
	AccountACL []ItemACLDataSourceModel `tfsdk:"account_acl"`
	K8SACL     []ItemACLDataSourceModel `tfsdk:"k8s_acl"`
	RGACL      []ItemACLDataSourceModel `tfsdk:"rg_acl"`
}

type ItemACLDataSourceModel struct {
	Explicit    types.Bool   `tfsdk:"explicit"`
	GUID        types.String `tfsdk:"guid"`
	Right       types.String `tfsdk:"right"`
	Status      types.String `tfsdk:"status"`
	Type        types.String `tfsdk:"type"`
	UserGroupID types.String `tfsdk:"user_group_id"`
}

type MasterGroupDataSourceModel struct {
	CPU             types.Int64                       `tfsdk:"cpu"`
	DetailedInfo    []ItemDetailedInfoDataSourceModel `tfsdk:"detailed_info"`
	Disk            types.Int64                       `tfsdk:"disk"`
	MasterGroupId   types.Int64                       `tfsdk:"master_group_id"`
	MasterGroupName types.String                      `tfsdk:"master_group_name"`
	Num             types.Int64                       `tfsdk:"num"`
	RAM             types.Int64                       `tfsdk:"ram"`
}

type ItemK8SGroupDataSourceModel struct {
	Annotations     types.List                        `tfsdk:"annotations"`
	CPU             types.Int64                       `tfsdk:"cpu"`
	DetailedInfo    []ItemDetailedInfoDataSourceModel `tfsdk:"detailed_info"`
	Disk            types.Int64                       `tfsdk:"disk"`
	GUID            types.String                      `tfsdk:"guid"`
	WorkerGroupID   types.Int64                       `tfsdk:"worker_group_id"`
	Labels          types.List                        `tfsdk:"labels"`
	WorkerGroupName types.String                      `tfsdk:"worker_group_name"`
	Num             types.Int64                       `tfsdk:"num"`
	RAM             types.Int64                       `tfsdk:"ram"`
	Taints          types.List                        `tfsdk:"taints"`
}

type ItemDetailedInfoDataSourceModel struct {
	ComputeId          types.Int64                     `tfsdk:"compute_id"`
	Name               types.String                    `tfsdk:"name"`
	Status             types.String                    `tfsdk:"status"`
	TechStatus         types.String                    `tfsdk:"tech_status"`
	Interfaces         []ItemInterfacesDataSourceModel `tfsdk:"interfaces"`
	NatableVinsIp      types.String                    `tfsdk:"natable_vins_ip"`
	NatableVinsNetwork types.String                    `tfsdk:"natable_vins_network"`
}

type ItemInterfacesDataSourceModel struct {
	DefGw     types.String `tfsdk:"def_gw"`
	IpAddress types.String `tfsdk:"ip_address"`
}
