package models

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

type DataSourceExtNetModel struct {
	// request fields
	NetID    types.Int64    `tfsdk:"net_id"`
	Timeouts timeouts.Value `tfsdk:"timeouts"`

	// response fields
	Id                 types.String           `tfsdk:"id"`
	CKey               types.String           `tfsdk:"ckey"`
	Meta               types.List             `tfsdk:"meta"`
	CheckIPs           types.List             `tfsdk:"check_ips"`
	Default            types.Bool             `tfsdk:"default"`
	DefaultQOS         *QOSModel              `tfsdk:"default_qos"`
	Description        types.String           `tfsdk:"desc"`
	DNS                types.List             `tfsdk:"dns"`
	Excluded           []ExcludedModel        `tfsdk:"excluded"`
	FreeIPs            types.Int64            `tfsdk:"free_ips"`
	Gateway            types.String           `tfsdk:"gateway"`
	GID                types.Int64            `tfsdk:"gid"`
	GUID               types.Int64            `tfsdk:"guid"`
	IPCIDR             types.String           `tfsdk:"ipcidr"`
	Milestones         types.Int64            `tfsdk:"milestones"`
	NetName            types.String           `tfsdk:"net_name"`
	Network            types.String           `tfsdk:"network"`
	NetworkID          types.Int64            `tfsdk:"network_id"`
	NTP                types.List             `tfsdk:"ntp"`
	PreReservationsNum types.Int64            `tfsdk:"pre_reservations_num"`
	Prefix             types.Int64            `tfsdk:"prefix"`
	PriVNFDevID        types.Int64            `tfsdk:"pri_vnf_dev_id"`
	Reservations       []ItemReservationModel `tfsdk:"reservations"`
	SharedWith         types.List             `tfsdk:"shared_with"`
	Status             types.String           `tfsdk:"status"`
	VLANID             types.Int64            `tfsdk:"vlan_id"`
	VNFs               *VNFsModel             `tfsdk:"vnfs"`
}

type VNFsModel struct {
	DHCP types.Int64 `tfsdk:"dhcp"`
}

type ExcludedModel struct {
	ClientType types.String `tfsdk:"client_type"`
	DomainName types.String `tfsdk:"domainname"`
	HostName   types.String `tfsdk:"hostname"`
	IP         types.String `tfsdk:"ip"`
	MAC        types.String `tfsdk:"mac"`
	Type       types.String `tfsdk:"type"`
	VMID       types.Int64  `tfsdk:"vm_id"`
}

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

type ItemReservationModel struct {
	AccountID   types.Int64  `tfsdk:"account_id"`
	ClientType  types.String `tfsdk:"client_type"`
	Description types.String `tfsdk:"desc"`
	DomainName  types.String `tfsdk:"domainname"`
	Hostname    types.String `tfsdk:"hostname"`
	IP          types.String `tfsdk:"ip"`
	MAC         types.String `tfsdk:"mac"`
	Type        types.String `tfsdk:"type"`
	VMID        types.Int64  `tfsdk:"vm_id"`
}

var ItemExcluded = map[string]attr.Type{
	"client_type": types.StringType,
	"mac":         types.StringType,
	"ip":          types.StringType,
	"type":        types.StringType,
	"vm_id":       types.Int64Type,
}
