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 ResourceLBBackendModel struct {
	Algorithm types.String   `tfsdk:"algorithm"`
	LBID      types.Int64    `tfsdk:"lb_id"`
	Name      types.String   `tfsdk:"name"`
	ID        types.String   `tfsdk:"id"`
	Timeouts  timeouts.Value `tfsdk:"timeouts"`
	GUID      types.String   `tfsdk:"guid"`
	Inter     types.Int64    `tfsdk:"inter"`
	DownInter types.Int64    `tfsdk:"downinter"`
	Rise      types.Int64    `tfsdk:"rise"`
	Fall      types.Int64    `tfsdk:"fall"`
	SlowStart types.Int64    `tfsdk:"slowstart"`
	MaxConn   types.Int64    `tfsdk:"maxconn"`
	MaxQueue  types.Int64    `tfsdk:"maxqueue"`
	Weight    types.Int64    `tfsdk:"weight"`
	Servers   types.List     `tfsdk:"servers"`
}

var ItemServers = map[string]attr.Type{
	"address":         types.StringType,
	"check":           types.StringType,
	"guid":            types.StringType,
	"name":            types.StringType,
	"port":            types.Int64Type,
	"server_settings": types.ObjectType{AttrTypes: ItemServerSettings},
}

var ItemServerSettings = map[string]attr.Type{
	"inter":     types.Int64Type,
	"guid":      types.StringType,
	"downinter": types.Int64Type,
	"rise":      types.Int64Type,
	"fall":      types.Int64Type,
	"slowstart": types.Int64Type,
	"maxconn":   types.Int64Type,
	"maxqueue":  types.Int64Type,
	"weight":    types.Int64Type,
}

type RecordServerModel struct {
	Address        types.String `tfsdk:"address"`
	Check          types.String `tfsdk:"check"`
	GUID           types.String `tfsdk:"guid"`
	Name           types.String `tfsdk:"name"`
	Port           types.Int64  `tfsdk:"port"`
	ServerSettings types.Object `tfsdk:"server_settings"`
}
