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 ResourceRecordDiskReplicationModel struct {
	// request fields
	DiskId      types.Int64    `tfsdk:"disk_id"`
	Name        types.String   `tfsdk:"disk_name"`
	SepID       types.Int64    `tfsdk:"sep_id"`
	PoolName    types.String   `tfsdk:"pool_name"`
	Pause       types.Bool     `tfsdk:"pause"`
	Reverse     types.Bool     `tfsdk:"reverse"`
	Start       types.Bool     `tfsdk:"start"`
	Detach      types.Bool     `tfsdk:"detach"`
	Permanently types.Bool     `tfsdk:"permanently"`
	Reason      types.String   `tfsdk:"reason"`
	Timeouts    timeouts.Value `tfsdk:"timeouts"`

	// response fields
	Id                types.String  `tfsdk:"id"`
	ACL               types.String  `tfsdk:"acl"`
	AccountID         types.Int64   `tfsdk:"account_id"`
	AccountName       types.String  `tfsdk:"account_name"`
	Computes          types.List    `tfsdk:"computes"`
	CreatedTime       types.Int64   `tfsdk:"created_time"`
	DeletedTime       types.Int64   `tfsdk:"deleted_time"`
	DeviceName        types.String  `tfsdk:"devicename"`
	Description       types.String  `tfsdk:"desc"`
	DestructionTime   types.Int64   `tfsdk:"destruction_time"`
	GID               types.Int64   `tfsdk:"gid"`
	ImageID           types.Int64   `tfsdk:"image_id"`
	ReplicationId     types.Int64   `tfsdk:"replica_disk_id"`
	Images            types.List    `tfsdk:"images"`
	IOTune            types.Object  `tfsdk:"iotune"`
	Order             types.Int64   `tfsdk:"order"`
	Params            types.String  `tfsdk:"params"`
	ParentID          types.Int64   `tfsdk:"parent_id"`
	PCISlot           types.Int64   `tfsdk:"pci_slot"`
	Pool              types.String  `tfsdk:"pool"`
	PresentTo         types.List    `tfsdk:"present_to"`
	PurgeTime         types.Int64   `tfsdk:"purge_time"`
	Replication       types.Object  `tfsdk:"replication"`
	ResID             types.String  `tfsdk:"res_id"`
	ResName           types.String  `tfsdk:"res_name"`
	Role              types.String  `tfsdk:"role"`
	SepType           types.String  `tfsdk:"sep_type"`
	Shareable         types.Bool    `tfsdk:"shareable"`
	SizeMax           types.Int64   `tfsdk:"size_max"`
	SizeUsed          types.Float64 `tfsdk:"size_used"`
	Snapshots         types.List    `tfsdk:"snapshots"`
	Status            types.String  `tfsdk:"status"`
	StatusReplication types.String  `tfsdk:"status_replication"`
	TechStatus        types.String  `tfsdk:"tech_status"`
	Type              types.String  `tfsdk:"type"`
	VMID              types.Int64   `tfsdk:"vmid"`
}

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

var ResourceDiskReplicationIOTune = map[string]attr.Type{
	"read_bytes_sec":      types.Int64Type,
	"read_bytes_sec_max":  types.Int64Type,
	"read_iops_sec":       types.Int64Type,
	"read_iops_sec_max":   types.Int64Type,
	"size_iops_sec":       types.Int64Type,
	"total_bytes_sec":     types.Int64Type,
	"total_bytes_sec_max": types.Int64Type,
	"total_iops_sec":      types.Int64Type,
	"total_iops_sec_max":  types.Int64Type,
	"write_bytes_sec":     types.Int64Type,
	"write_bytes_sec_max": types.Int64Type,
	"write_iops_sec":      types.Int64Type,
	"write_iops_sec_max":  types.Int64Type,
}

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

var ResourceItemReplication = map[string]attr.Type{
	"disk_id":        types.Int64Type,
	"pool_id":        types.StringType,
	"role":           types.StringType,
	"self_volume_id": types.StringType,
	"storage_id:":    types.StringType,
	"volume_id":      types.StringType,
}
