package models

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

type ResourceAccountModel struct {
	// request fields - required
	AccountName types.String `tfsdk:"account_name"`
	Username    types.String `tfsdk:"username"`

	// request fields - optional
	EmailAddress           types.String   `tfsdk:"emailaddress"`
	SendAccessEmails       types.Bool     `tfsdk:"send_access_emails"`
	Users                  types.List     `tfsdk:"users"`
	UniqPools              types.List     `tfsdk:"uniq_pools"`
	CPUAllocationParameter types.String   `tfsdk:"cpu_allocation_parameter"`
	CPUAllocationRatio     types.Float64  `tfsdk:"cpu_allocation_ratio"`
	AvailableTemplates     types.Set      `tfsdk:"available_templates"`
	Restore                types.Bool     `tfsdk:"restore"`
	Permanently            types.Bool     `tfsdk:"permanently"`
	Enable                 types.Bool     `tfsdk:"enable"`
	ResourceLimits         types.Object   `tfsdk:"resource_limits"`
	ComputeFeatures        types.Set      `tfsdk:"compute_features"`
	Timeouts               timeouts.Value `tfsdk:"timeouts"`

	// response fields
	Id               types.String  `tfsdk:"id"`
	DCLocation       types.String  `tfsdk:"dc_location"`
	AccountID        types.Int64   `tfsdk:"account_id"`
	CKey             types.String  `tfsdk:"ckey"`
	ACL              types.List    `tfsdk:"acl"`
	Company          types.String  `tfsdk:"company"`
	CompanyURL       types.String  `tfsdk:"companyurl"`
	CreatedBy        types.String  `tfsdk:"created_by"`
	CreatedTime      types.Int64   `tfsdk:"created_time"`
	DeactivationTime types.Float64 `tfsdk:"deactivation_time"`
	DeletedBy        types.String  `tfsdk:"deleted_by"`
	DeletedTime      types.Int64   `tfsdk:"deleted_time"`
	DisplayName      types.String  `tfsdk:"displayname"`
	GUID             types.Int64   `tfsdk:"guid"`
	ResourceTypes    types.List    `tfsdk:"resource_types"`
	Status           types.String  `tfsdk:"status"`
	UpdatedTime      types.Int64   `tfsdk:"updated_time"`
	Version          types.Int64   `tfsdk:"version"`
	VINS             types.List    `tfsdk:"vins"`
}

type UsersModel struct {
	UserID     types.String `tfsdk:"user_id"`
	AccessType types.String `tfsdk:"access_type"`
}

type ResourceLimitsInAccountResourceModel struct {
	CUC      types.Float64 `tfsdk:"cu_c"`
	CUD      types.Float64 `tfsdk:"cu_d"`
	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 ItemResourceLimitsInAccountResource = map[string]attr.Type{
	"cu_c":      types.Float64Type,
	"cu_d":      types.Float64Type,
	"cu_i":      types.Float64Type,
	"cu_m":      types.Float64Type,
	"cu_np":     types.Float64Type,
	"gpu_units": types.Float64Type,
}

type ACLInAccountModel 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 ItemACLInAccount = map[string]attr.Type{
	"explicit":      types.BoolType,
	"guid":          types.StringType,
	"right":         types.StringType,
	"status":        types.StringType,
	"type":          types.StringType,
	"user_group_id": types.StringType,
}
