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"`

	// request fields - optional
	SendAccessEmails types.Bool     `tfsdk:"send_access_emails"`
	Users            types.Set      `tfsdk:"users"`
	Restore          types.Bool     `tfsdk:"restore"`
	Permanently      types.Bool     `tfsdk:"permanently"`
	Enable           types.Bool     `tfsdk:"enable"`
	ResourceLimits   types.Object   `tfsdk:"resource_limits"`
	Timeouts         timeouts.Value `tfsdk:"timeouts"`
	Desc             types.String   `tfsdk:"desc"`

	// response fields
	Id                     types.String  `tfsdk:"id"`
	LastUpdated            types.String  `tfsdk:"last_updated"`
	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"`
	ComputeFeatures        types.List    `tfsdk:"compute_features"`
	Computes               types.Object  `tfsdk:"computes"`
	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"`
	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"`
	Machines               types.Object  `tfsdk:"machines"`
	Reason                 types.String  `tfsdk:"reason"`
	Status                 types.String  `tfsdk:"status"`
	UpdatedTime            types.Int64   `tfsdk:"updated_time"`
	Version                types.Int64   `tfsdk:"version"`
	VINS                   types.List    `tfsdk:"vins"`
	VINSes                 types.Int64   `tfsdk:"vinses"`
}

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

var ItemUsersResource = map[string]attr.Type{
	"user_id":     types.StringType,
	"access_type": types.StringType,
}

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,
}
