package models

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

type DataSourceRGListComputesModel struct {
	// request required fields
	RGID types.Int64 `tfsdk:"rg_id"`

	// request optional fields
	ComputeID  types.Int64    `tfsdk:"compute_id"`
	Name       types.String   `tfsdk:"name"`
	AccountID  types.Int64    `tfsdk:"account_id"`
	TechStatus types.String   `tfsdk:"tech_status"`
	Status     types.String   `tfsdk:"status"`
	IPAddress  types.String   `tfsdk:"ip_address"`
	ExtNetName types.String   `tfsdk:"extnet_name"`
	ExtNetID   types.Int64    `tfsdk:"extnet_id"`
	SortBy     types.String   `tfsdk:"sort_by"`
	Page       types.Int64    `tfsdk:"page"`
	Size       types.Int64    `tfsdk:"size"`
	Timeouts   timeouts.Value `tfsdk:"timeouts"`

	// response fields
	Id         types.String              `tfsdk:"id"`
	Items      []ItemsRGListComputeModel `tfsdk:"items"`
	EntryCount types.Int64               `tfsdk:"entry_count"`
}

type ItemsRGListComputeModel struct {
	AccountID         types.Int64  `tfsdk:"account_id"`
	AccountName       types.String `tfsdk:"account_name"`
	AffinityLabel     types.String `tfsdk:"affinity_label"`
	AffinityRules     types.List   `tfsdk:"affinity_rules"`
	AffinityWeight    types.Int64  `tfsdk:"affinity_weight"`
	AntiAffinityRules types.List   `tfsdk:"antiaffinity_rules"`
	CPUs              types.Int64  `tfsdk:"cpus"`
	CreatedBy         types.String `tfsdk:"created_by"`
	CreatedTime       types.Int64  `tfsdk:"created_time"`
	DeletedBy         types.String `tfsdk:"deleted_by"`
	DeletedTime       types.Int64  `tfsdk:"deleted_time"`
	ID                types.Int64  `tfsdk:"id"`
	Name              types.String `tfsdk:"name"`
	RAM               types.Int64  `tfsdk:"ram"`
	Registered        types.Bool   `tfsdk:"registered"`
	RGID              types.Int64  `tfsdk:"rg_id"`
	RGName            types.String `tfsdk:"rg_name"`
	Status            types.String `tfsdk:"status"`
	TechStatus        types.String `tfsdk:"tech_status"`
	TotalDisksSize    types.Int64  `tfsdk:"total_disks_size"`
	UpdatedBy         types.String `tfsdk:"updated_by"`
	UpdatedTime       types.Int64  `tfsdk:"updated_time"`
	UserManaged       types.Bool   `tfsdk:"user_managed"`
	VINSConnected     types.Int64  `tfsdk:"vins_connected"`
}

type AffinityRuleModel struct {
	GUID     types.String `tfsdk:"guid"`
	Key      types.String `tfsdk:"key"`
	Mode     types.String `tfsdk:"mode"`
	Policy   types.String `tfsdk:"policy"`
	Topology types.String `tfsdk:"topology"`
	Value    types.String `tfsdk:"value"`
}

var ItemAffinityRule = map[string]attr.Type{
	"guid":     types.StringType,
	"key":      types.StringType,
	"mode":     types.StringType,
	"policy":   types.StringType,
	"topology": types.StringType,
	"value":    types.StringType,
}
