package schemas

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

func MakeSchemaDataSourceLB() map[string]schema.Attribute {
	return map[string]schema.Attribute{
		"lb_id": schema.Int64Attribute{
			Required: true,
		},
		"ha_mode": schema.BoolAttribute{
			Computed: true,
		},
		"acl": schema.StringAttribute{
			Computed: true,
		},
		"backend_haip": schema.StringAttribute{
			Computed: true,
		},
		"backends": schema.ListNestedAttribute{
			Computed: true,
			NestedObject: schema.NestedAttributeObject{
				Attributes: map[string]schema.Attribute{
					"algorithm": schema.StringAttribute{
						Computed: true,
					},
					"guid": schema.StringAttribute{
						Computed: true,
					},
					"name": schema.StringAttribute{
						Computed: true,
					},
					"server_default_settings": schema.SingleNestedAttribute{
						Computed: true,
						Attributes: map[string]schema.Attribute{
							"downinter": schema.Int64Attribute{
								Computed: true,
							},
							"fall": schema.Int64Attribute{
								Computed: true,
							},
							"guid": schema.StringAttribute{
								Computed: true,
							},
							"inter": schema.Int64Attribute{
								Computed: true,
							},
							"maxconn": schema.Int64Attribute{
								Computed: true,
							},
							"maxqueue": schema.Int64Attribute{
								Computed: true,
							},
							"rise": schema.Int64Attribute{
								Computed: true,
							},
							"slowstart": schema.Int64Attribute{
								Computed: true,
							},
							"weight": schema.Int64Attribute{
								Computed: true,
							},
						},
					},
					"servers": schema.ListNestedAttribute{
						Computed: true,
						NestedObject: schema.NestedAttributeObject{
							Attributes: map[string]schema.Attribute{
								"address": schema.StringAttribute{
									Computed: true,
								},
								"check": schema.StringAttribute{
									Computed: true,
								},
								"guid": schema.StringAttribute{
									Computed: true,
								},
								"name": schema.StringAttribute{
									Computed: true,
								},
								"port": schema.Int64Attribute{
									Computed: true,
								},
								"server_settings": schema.SingleNestedAttribute{
									Computed: true,
									Attributes: map[string]schema.Attribute{
										"downinter": schema.Int64Attribute{
											Computed: true,
										},
										"fall": schema.Int64Attribute{
											Computed: true,
										},
										"guid": schema.StringAttribute{
											Computed: true,
										},
										"inter": schema.Int64Attribute{
											Computed: true,
										},
										"maxconn": schema.Int64Attribute{
											Computed: true,
										},
										"maxqueue": schema.Int64Attribute{
											Computed: true,
										},
										"rise": schema.Int64Attribute{
											Computed: true,
										},
										"slowstart": schema.Int64Attribute{
											Computed: true,
										},
										"weight": schema.Int64Attribute{
											Computed: true,
										},
									},
								},
							},
						},
					},
				},
			},
		},
		"ckey": schema.StringAttribute{
			Computed: true,
		},
		"desc": schema.StringAttribute{
			Computed: true,
		},
		"dp_api_user": schema.StringAttribute{
			Computed: true,
		},
		"dp_api_password": schema.StringAttribute{
			Computed: true,
		},
		"extnet_id": schema.Int64Attribute{
			Computed: true,
		},
		"frontend_haip": schema.StringAttribute{
			Computed: true,
		},
		"frontends": schema.ListNestedAttribute{
			Computed: true,
			NestedObject: schema.NestedAttributeObject{
				Attributes: map[string]schema.Attribute{
					"backend": schema.StringAttribute{
						Computed: true,
					},
					"bindings": schema.ListNestedAttribute{
						Computed: true,
						NestedObject: schema.NestedAttributeObject{
							Attributes: map[string]schema.Attribute{
								"address": schema.StringAttribute{
									Computed: true,
								},
								"guid": schema.StringAttribute{
									Computed: true,
								},
								"name": schema.StringAttribute{
									Computed: true,
								},
								"port": schema.Int64Attribute{
									Computed: true,
								},
							},
						},
					},
					"guid": schema.StringAttribute{
						Computed: true,
					},
					"name": schema.StringAttribute{
						Computed: true,
					},
				},
			},
		},
		"gid": schema.Int64Attribute{
			Computed: true,
		},
		"guid": schema.Int64Attribute{
			Computed: true,
		},
		"id": schema.Int64Attribute{
			Computed: true,
		},
		"manager_id": schema.Int64Attribute{
			Computed: true,
		},
		"manager_type": schema.StringAttribute{
			Computed: true,
		},
		"image_id": schema.Int64Attribute{
			Computed: true,
		},
		"meta": schema.ListAttribute{
			Computed:    true,
			ElementType: types.StringType,
		},
		"milestones": schema.Int64Attribute{
			Computed: true,
		},
		"name": schema.StringAttribute{
			Computed: true,
		},
		"part_k8s": schema.BoolAttribute{
			Computed: true,
		},
		"primary_node": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"backend_ip": schema.StringAttribute{
					Computed: true,
				},
				"compute_id": schema.Int64Attribute{
					Computed: true,
				},
				"frontend_ip": schema.StringAttribute{
					Computed: true,
				},
				"guid": schema.StringAttribute{
					Computed: true,
				},
				"mgmt_ip": schema.StringAttribute{
					Computed: true,
				},
				"network_id": schema.Int64Attribute{
					Computed: true,
				},
			},
		},
		"rg_id": schema.Int64Attribute{
			Computed: true,
		},
		"secondary_node": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"backend_ip": schema.StringAttribute{
					Computed: true,
				},
				"compute_id": schema.Int64Attribute{
					Computed: true,
				},
				"frontend_ip": schema.StringAttribute{
					Computed: true,
				},
				"guid": schema.StringAttribute{
					Computed: true,
				},
				"mgmt_ip": schema.StringAttribute{
					Computed: true,
				},
				"network_id": schema.Int64Attribute{
					Computed: true,
				},
			},
		},
		"status": schema.StringAttribute{
			Computed: true,
		},
		"tech_status": schema.StringAttribute{
			Computed: true,
		},
		"user_managed": schema.BoolAttribute{
			Computed: true,
		},
		"vins_id": schema.Int64Attribute{
			Computed: true,
		},
	}
}
