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 DataSourceRGModel struct {
	// request fields
	RGID     types.Int64    `tfsdk:"rg_id"`
	Timeouts timeouts.Value `tfsdk:"timeouts"`

	// response fields
	AccountID              types.Int64   `tfsdk:"account_id"`
	AccountName            types.String  `tfsdk:"account_name"`
	ACL                    types.List    `tfsdk:"acl"`
	ComputeFeatures        types.List    `tfsdk:"compute_features"`
	CPUAllocationParameter types.String  `tfsdk:"cpu_allocation_parameter"`
	CPUAllocationRatio     types.Float64 `tfsdk:"cpu_allocation_ratio"`
	CreatedBy              types.String  `tfsdk:"created_by"`
	CreatedTime            types.Int64   `tfsdk:"created_time"`
	DefNetID               types.Int64   `tfsdk:"def_net_id"`
	DefNetType             types.String  `tfsdk:"def_net_type"`
	DeletedBy              types.String  `tfsdk:"deleted_by"`
	DeletedTime            types.Int64   `tfsdk:"deleted_time"`
	Description            types.String  `tfsdk:"desc"`
	Dirty                  types.Bool    `tfsdk:"dirty"`
	GID                    types.Int64   `tfsdk:"gid"`
	GUID                   types.Int64   `tfsdk:"guid"`
	Id                     types.String  `tfsdk:"id"`
	LockStatus             types.String  `tfsdk:"lock_status"`
	Milestones             types.Int64   `tfsdk:"milestones"`
	Name                   types.String  `tfsdk:"name"`
	RegisterComputes       types.Bool    `tfsdk:"register_computes"`
	ResourceLimits         types.Object  `tfsdk:"resource_limits"`
	ResourceTypes          types.List    `tfsdk:"resource_types"`
	Secret                 types.String  `tfsdk:"secret"`
	Status                 types.String  `tfsdk:"status"`
	UniqPools              types.List    `tfsdk:"uniq_pools"`
	UpdatedBy              types.String  `tfsdk:"updated_by"`
	UpdatedTime            types.Int64   `tfsdk:"updated_time"`
	VINS                   types.List    `tfsdk:"vins"`
	Computes               types.List    `tfsdk:"computes"`
}

type ResourceLimitsModel struct {
	CUC      types.Float64 `tfsdk:"cu_c"`
	CUD      types.Float64 `tfsdk:"cu_d"`
	CUDM     types.Float64 `tfsdk:"cu_dm"`
	CUI      types.Float64 `tfsdk:"cu_i"`
	CUM      types.Float64 `tfsdk:"cu_m"`
	CUNP     types.Float64 `tfsdk:"cu_np"`
	GPUUnits types.Float64 `tfsdk:"gpu_units"`
}

var ItemResourseModel = map[string]attr.Type{
	"cu_c":      types.Float64Type,
	"cu_d":      types.Float64Type,
	"cu_dm":     types.Float64Type,
	"cu_i":      types.Float64Type,
	"cu_m":      types.Float64Type,
	"cu_np":     types.Float64Type,
	"gpu_units": types.Float64Type,
}

type ItemACLModel 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"`
}

var ItemACL = map[string]attr.Type{
	"explicit":      types.BoolType,
	"guid":          types.StringType,
	"right":         types.StringType,
	"status":        types.StringType,
	"type":          types.StringType,
	"user_group_id": types.StringType,
}
