package models

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

type DataSourceAccountRGListModel struct {
	// optional and required fields
	AccountID types.Int64    `tfsdk:"account_id"`
	RGID      types.Int64    `tfsdk:"rg_id"`
	VinsID    types.Int64    `tfsdk:"vins_id"`
	VMID      types.Int64    `tfsdk:"vm_id"`
	Name      types.String   `tfsdk:"name"`
	Status    types.String   `tfsdk:"status"`
	Page      types.Int64    `tfsdk:"page"`
	Size      types.Int64    `tfsdk:"size"`
	Timeouts  timeouts.Value `tfsdk:"timeouts"`
	SortBy    types.String   `tfsdk:"sort_by"`

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

type ItemAccountRGModel struct {
	Computes    *RGComputesModel  `tfsdk:"computes"`
	Resources   *RGResourcesModel `tfsdk:"resources"`
	CreatedBy   types.String      `tfsdk:"created_by"`
	CreatedTime types.Int64       `tfsdk:"created_time"`
	DeletedBy   types.String      `tfsdk:"deleted_by"`
	DeletedTime types.Int64       `tfsdk:"deleted_time"`
	Desc        types.String      `tfsdk:"desc"`
	RGID        types.Int64       `tfsdk:"rg_id"`
	Milestones  types.Int64       `tfsdk:"milestones"`
	RGName      types.String      `tfsdk:"rg_name"`
	Status      types.String      `tfsdk:"status"`
	UpdatedBy   types.String      `tfsdk:"updated_by"`
	UpdatedTime types.Int64       `tfsdk:"updated_time"`
	VINSes      types.Int64       `tfsdk:"vinses"`
}

type RGComputesModel struct {
	Started types.Int64 `tfsdk:"started"`
	Stopped types.Int64 `tfsdk:"stopped"`
}

type RGResourcesModel struct {
	Consumed *ResourceModel `tfsdk:"consumed"`
	Limits   *LimitsRGModel `tfsdk:"limits"`
	Reserved *ResourceModel `tfsdk:"reserved"`
}

type LimitsRGModel struct {
	CPU         types.Int64 `tfsdk:"cpu"`
	DiskSize    types.Int64 `tfsdk:"disksize"`
	DiskSizeMax types.Int64 `tfsdk:"disksizemax"`
	ExtIPs      types.Int64 `tfsdk:"extips"`
	ExtTraffic  types.Int64 `tfsdk:"exttraffic"`
	GPU         types.Int64 `tfsdk:"gpu"`
	RAM         types.Int64 `tfsdk:"ram"`
	SEPs        types.Int64 `tfsdk:"seps"`
}

type ResourceModel struct {
	CPU         types.Int64   `tfsdk:"cpu"`
	DiskSize    types.Float64 `tfsdk:"disksize"`
	DiskSizeMax types.Float64 `tfsdk:"disksizemax"`
	ExtIPs      types.Int64   `tfsdk:"extips"`
	ExtTraffic  types.Int64   `tfsdk:"exttraffic"`
	GPU         types.Int64   `tfsdk:"gpu"`
	RAM         types.Int64   `tfsdk:"ram"`
	SEPs        []SepModel    `tfsdk:"seps"`
}

type SepModel struct {
	SepID       types.String  `tfsdk:"sep_id"`
	PoolName    types.String  `tfsdk:"pool_name"`
	DiskSize    types.Float64 `tfsdk:"disksize"`
	DiskSizeMax types.Float64 `tfsdk:"disksizemax"`
}
