package models

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

type RecordComputeModel struct {
	// request fields
	ComputeId types.Int64    `tfsdk:"compute_id"`
	Timeouts  timeouts.Value `tfsdk:"timeouts"`
	// response fields
	Id                     types.String         `tfsdk:"id"`
	ACL                    *RecordACLModel      `tfsdk:"acl"`
	AccountID              types.Int64          `tfsdk:"account_id"`
	AccountName            types.String         `tfsdk:"account_name"`
	AffinityLabel          types.String         `tfsdk:"affinity_label"`
	AffinityRules          []ItemRuleModel      `tfsdk:"affinity_rules"`
	AffinityWeight         types.Int64          `tfsdk:"affinity_weight"`
	AntiAffinityRules      []ItemRuleModel      `tfsdk:"anti_affinity_rules"`
	Architecture           types.String         `tfsdk:"arch"`
	AutoStartWithNode      types.Bool           `tfsdk:"auto_start_w_node"`
	Chipset                types.String         `tfsdk:"chipset"`
	BootOrder              types.List           `tfsdk:"boot_order"`
	BootDiskSize           types.Int64          `tfsdk:"bootdisk_size"`
	CdImageId              types.Int64          `tfsdk:"cd_image_id"`
	CloneReference         types.Int64          `tfsdk:"clone_reference"`
	Clones                 types.List           `tfsdk:"clones"`
	ComputeCIID            types.Int64          `tfsdk:"computeci_id"`
	CPU                    types.Int64          `tfsdk:"cpus"`
	CPUPin                 types.Bool           `tfsdk:"cpu_pin"`
	CreatedBy              types.String         `tfsdk:"created_by"`
	CreatedTime            types.Int64          `tfsdk:"created_time"`
	CustomFields           types.String         `tfsdk:"custom_fields"`
	DeletedBy              types.String         `tfsdk:"deleted_by"`
	DeletedTime            types.Int64          `tfsdk:"deleted_time"`
	Description            types.String         `tfsdk:"desc"`
	Devices                types.String         `tfsdk:"devices"`
	Disks                  []ItemDiskModel      `tfsdk:"disks"`
	Driver                 types.String         `tfsdk:"driver"`
	GID                    types.Int64          `tfsdk:"gid"`
	GUID                   types.Int64          `tfsdk:"guid"`
	HPBacked               types.Bool           `tfsdk:"hp_backed"`
	ImageID                types.Int64          `tfsdk:"image_id"`
	ImageName              types.String         `tfsdk:"image_name"`
	Interfaces             []ItemInterfaceModel `tfsdk:"interfaces"`
	LockStatus             types.String         `tfsdk:"lock_status"`
	ManagerID              types.Int64          `tfsdk:"manager_id"`
	ManagerType            types.String         `tfsdk:"manager_type"`
	MigrationJob           types.Int64          `tfsdk:"migrationjob"`
	Milestones             types.Int64          `tfsdk:"milestones"`
	Name                   types.String         `tfsdk:"name"`
	NatableVINSID          types.Int64          `tfsdk:"natable_vins_id"`
	NatableVINSIP          types.String         `tfsdk:"natable_vins_ip"`
	NatableVINSName        types.String         `tfsdk:"natable_vins_name"`
	NatableVINSNetwork     types.String         `tfsdk:"natable_vins_network"`
	NatableVINSNetworkName types.String         `tfsdk:"natable_vins_network_name"`
	NeedReboot             types.Bool           `tfsdk:"need_reboot"`
	NumaAffinity           types.String         `tfsdk:"numa_affinity"`
	NumaNodeId             types.Int64          `tfsdk:"numa_node_id"`
	OSUsers                []ItemOSUserModel    `tfsdk:"os_users"`
	PCIDevices             types.List           `tfsdk:"pci_devices"`
	Pinned                 types.Bool           `tfsdk:"pinned"`
	PreferredCPU           types.List           `tfsdk:"preferred_cpu"`
	RAM                    types.Int64          `tfsdk:"ram"`
	ReferenceID            types.String         `tfsdk:"reference_id"`
	Registered             types.Bool           `tfsdk:"registered"`
	ResName                types.String         `tfsdk:"res_name"`
	ReservedNodeCpus       types.List           `tfsdk:"reserved_node_cpus"`
	RGID                   types.Int64          `tfsdk:"rg_id"`
	RGName                 types.String         `tfsdk:"rg_name"`
	SnapSets               []ItemSnapSetModel   `tfsdk:"snap_sets"`
	StatelessSepID         types.Int64          `tfsdk:"stateless_sep_id"`
	StatelessSepType       types.String         `tfsdk:"stateless_sep_type"`
	Status                 types.String         `tfsdk:"status"`
	Tags                   types.Map            `tfsdk:"tags"`
	TechStatus             types.String         `tfsdk:"tech_status"`
	UpdatedBy              types.String         `tfsdk:"updated_by"`
	UpdatedTime            types.Int64          `tfsdk:"updated_time"`
	UserManaged            types.Bool           `tfsdk:"user_managed"`
	Userdata               types.String         `tfsdk:"user_data"`
	VGPUs                  []VGPUModel          `tfsdk:"vgpus"`
	VirtualImageID         types.Int64          `tfsdk:"virtual_image_id"`
	VirtualImageName       types.String         `tfsdk:"virtual_image_name"`
	VNCPassword            types.String         `tfsdk:"vnc_password"`
	LoaderType             types.String         `tfsdk:"loader_type"`
	BootType               types.String         `tfsdk:"boot_type"`
	HotResize              types.Bool           `tfsdk:"hot_resize"`
	NetworkInterfaceNaming types.String         `tfsdk:"network_interface_naming"`
}

type RecordACLModel struct {
	AccountACL []ItemACLModel `tfsdk:"account_acl"`
	ComputeACL []ItemACLModel `tfsdk:"compute_acl"`
	RGACL      []ItemACLModel `tfsdk:"rg_acl"`
}

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

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

type ItemDiskModel struct {
	CKey                types.String              `tfsdk:"ckey"`
	ACL                 types.String              `tfsdk:"acl"`
	AccountID           types.Int64               `tfsdk:"account_id"`
	BootPartition       types.Int64               `tfsdk:"boot_partition"`
	BusNumber           types.Int64               `tfsdk:"bus_number"`
	CreatedTime         types.Int64               `tfsdk:"created_time"`
	DeletedTime         types.Int64               `tfsdk:"deleted_time"`
	Description         types.String              `tfsdk:"desc"`
	DestructionTime     types.Int64               `tfsdk:"destruction_time"`
	DiskPath            types.String              `tfsdk:"disk_path"`
	GID                 types.Int64               `tfsdk:"gid"`
	GUID                types.Int64               `tfsdk:"guid"`
	ID                  types.Int64               `tfsdk:"disk_id"`
	ImageID             types.Int64               `tfsdk:"image_id"`
	Images              types.List                `tfsdk:"images"`
	IOTune              *IOTuneModel              `tfsdk:"iotune"`
	IQN                 types.String              `tfsdk:"iqn"`
	Login               types.String              `tfsdk:"login"`
	Milestones          types.Int64               `tfsdk:"milestones"`
	Name                types.String              `tfsdk:"name"`
	Order               types.Int64               `tfsdk:"order"`
	Params              types.String              `tfsdk:"params"`
	ParentID            types.Int64               `tfsdk:"parent_id"`
	Passwd              types.String              `tfsdk:"passwd"`
	PCISlot             types.Int64               `tfsdk:"pci_slot"`
	Pool                types.String              `tfsdk:"pool"`
	PresentTo           types.Map                 `tfsdk:"present_to"`
	PurgeTime           types.Int64               `tfsdk:"purge_time"`
	ReferenceID         types.String              `tfsdk:"reference_id"`
	RealityDeviceNumber types.Int64               `tfsdk:"reality_device_number"`
	Replication         *ReplicationModel         `tfsdk:"replication"`
	ResID               types.String              `tfsdk:"res_id"`
	Role                types.String              `tfsdk:"role"`
	SepID               types.Int64               `tfsdk:"sep_id"`
	Shareable           types.Bool                `tfsdk:"shareable"`
	SizeAvailable       types.Float64             `tfsdk:"size_available"`
	SizeMax             types.Int64               `tfsdk:"size_max"`
	SizeUsed            types.Float64             `tfsdk:"size_used"`
	Snapshots           []ItemSnapshotExtendModel `tfsdk:"snapshots"`
	Status              types.String              `tfsdk:"status"`
	TechStatus          types.String              `tfsdk:"tech_status"`
	Type                types.String              `tfsdk:"type"`
	VMID                types.Int64               `tfsdk:"vmid"`
}

type ItemInterfaceModel struct {
	BusNumber       types.Int64   `tfsdk:"bus_number"`
	ConnID          types.Int64   `tfsdk:"conn_id"`
	ConnType        types.String  `tfsdk:"conn_type"`
	DefGW           types.String  `tfsdk:"def_gw"`
	Enabled         types.Bool    `tfsdk:"enabled"`
	FLIPGroupID     types.Int64   `tfsdk:"flip_group_id"`
	GUID            types.String  `tfsdk:"guid"`
	IPAddress       types.String  `tfsdk:"ip_address"`
	LibvirtSettings *LibvirtModel `tfsdk:"libvirt_settings"`
	ListenSSH       types.Bool    `tfsdk:"listen_ssh"`
	MAC             types.String  `tfsdk:"mac"`
	MTU             types.Int64   `tfsdk:"mtu"`
	Name            types.String  `tfsdk:"name"`
	NetID           types.Int64   `tfsdk:"net_id"`
	NetMask         types.Int64   `tfsdk:"netmask"`
	NetType         types.String  `tfsdk:"net_type"`
	NodeID          types.Int64   `tfsdk:"node_id"`
	PCISlot         types.Int64   `tfsdk:"pci_slot"`
	QOS             *QOSModel     `tfsdk:"qos"`
	Target          types.String  `tfsdk:"target"`
	Type            types.String  `tfsdk:"type"`
	VNFs            types.List    `tfsdk:"vnfs"`
}

type QOSModel struct {
	ERate   types.Int64  `tfsdk:"e_rate"`
	GUID    types.String `tfsdk:"guid"`
	InBurst types.Int64  `tfsdk:"in_burst"`
	InRate  types.Int64  `tfsdk:"in_rate"`
}

type LibvirtModel struct {
	GUID        types.String `tfsdk:"guid"`
	TXMode      types.String `tfsdk:"txmode"`
	IOEventFD   types.String `tfsdk:"ioeventfd"`
	EventIDx    types.String `tfsdk:"event_idx"`
	Queues      types.Int64  `tfsdk:"queues"`
	RXQueueSize types.Int64  `tfsdk:"rx_queue_size"`
	TXQueueSize types.Int64  `tfsdk:"tx_queue_size"`
}

type ItemSnapSetModel struct {
	Disks     types.List   `tfsdk:"disks"`
	GUID      types.String `tfsdk:"guid"`
	Label     types.String `tfsdk:"label"`
	Timestamp types.Int64  `tfsdk:"timestamp"`
}

type IOTuneModel struct {
	ReadBytesSec     types.Int64 `tfsdk:"read_bytes_sec"`
	ReadBytesSecMax  types.Int64 `tfsdk:"read_bytes_sec_max"`
	ReadIOPSSec      types.Int64 `tfsdk:"read_iops_sec"`
	ReadIOPSSecMax   types.Int64 `tfsdk:"read_iops_sec_max"`
	SizeIOPSSec      types.Int64 `tfsdk:"size_iops_sec"`
	TotalBytesSec    types.Int64 `tfsdk:"total_bytes_sec"`
	TotalBytesSecMax types.Int64 `tfsdk:"total_bytes_sec_max"`
	TotalIOPSSec     types.Int64 `tfsdk:"total_iops_sec"`
	TotalIOPSSecMax  types.Int64 `tfsdk:"total_iops_sec_max"`
	WriteBytesSec    types.Int64 `tfsdk:"write_bytes_sec"`
	WriteBytesSecMax types.Int64 `tfsdk:"write_bytes_sec_max"`
	WriteIOPSSec     types.Int64 `tfsdk:"write_iops_sec"`
	WriteIOPSSecMax  types.Int64 `tfsdk:"write_iops_sec_max"`
}

type ItemSnapshotExtendModel struct {
	GUID        types.String `tfsdk:"guid"`
	Label       types.String `tfsdk:"label"`
	ReferenceID types.String `tfsdk:"reference_id"`
	ResID       types.String `tfsdk:"res_id"`
	SnapSetGUID types.String `tfsdk:"snap_set_guid"`
	SnapSetTime types.Int64  `tfsdk:"snap_set_time"`
	TimeStamp   types.Int64  `tfsdk:"timestamp"`
}

type ItemOSUserModel struct {
	GUID     types.String `tfsdk:"guid"`
	Login    types.String `tfsdk:"login"`
	Password types.String `tfsdk:"password"`
	PubKey   types.String `tfsdk:"public_key"`
}

type ReplicationModel struct {
	DiskID       types.Int64  `tfsdk:"disk_id"`
	PoolID       types.String `tfsdk:"pool_id"`
	Role         types.String `tfsdk:"role"`
	SelfVolumeID types.String `tfsdk:"self_volume_id"`
	StorageID    types.String `tfsdk:"storage_id"`
	VolumeID     types.String `tfsdk:"volume_id"`
}

type VGPUModel struct {
	ID             types.Int64  `tfsdk:"id"`
	GID            types.Int64  `tfsdk:"gid"`
	Type           types.String `tfsdk:"type"`
	Mode           types.String `tfsdk:"mode"`
	Status         types.String `tfsdk:"status"`
	ProfileID      types.Int64  `tfsdk:"profile_id"`
	RAM            types.Int64  `tfsdk:"ram"`
	LastUpdateTime types.Int64  `tfsdk:"last_update_time"`
	CreatedTime    types.Int64  `tfsdk:"created_time"`
	DeletedTime    types.Int64  `tfsdk:"deleted_time"`
	VMID           types.Int64  `tfsdk:"vmid"`
	PGPUID         types.Int64  `tfsdk:"pgpuid"`
	ReferenceID    types.String `tfsdk:"reference_id"`
	AccountID      types.Int64  `tfsdk:"account_id"`
	RGID           types.Int64  `tfsdk:"rg_id"`
	LastClaimedBy  types.Int64  `tfsdk:"last_claimed_by"`
	PCISlot        types.Int64  `tfsdk:"pci_slot"`
	BusNumber      types.Int64  `tfsdk:"bus_number"`
	GUID           types.Int64  `tfsdk:"guid"`
}
