package schemas

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

func MakeSchemaDataSourceK8S() map[string]schema.Attribute {
	return map[string]schema.Attribute{
		// required attributes
		"k8s_id": schema.Int64Attribute{
			Required: true,
		},
		// computed attributes
		"id": schema.StringAttribute{
			Computed: true,
		},
		"acl": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"account_acl": schema.ListNestedAttribute{
					Computed: true,
					NestedObject: schema.NestedAttributeObject{
						Attributes: map[string]schema.Attribute{
							"explicit": schema.BoolAttribute{
								Computed: true,
							},
							"guid": schema.StringAttribute{
								Computed: true,
							},
							"right": schema.StringAttribute{
								Computed: true,
							},
							"status": schema.StringAttribute{
								Computed: true,
							},
							"type": schema.StringAttribute{
								Computed: true,
							},
							"user_group_id": schema.StringAttribute{
								Computed: true,
							},
						},
					},
				},
				"k8s_acl": schema.ListNestedAttribute{
					Computed: true,
					NestedObject: schema.NestedAttributeObject{
						Attributes: map[string]schema.Attribute{
							"explicit": schema.BoolAttribute{
								Computed: true,
							},
							"guid": schema.StringAttribute{
								Computed: true,
							},
							"right": schema.StringAttribute{
								Computed: true,
							},
							"status": schema.StringAttribute{
								Computed: true,
							},
							"type": schema.StringAttribute{
								Computed: true,
							},
							"user_group_id": schema.StringAttribute{
								Computed: true,
							},
						},
					},
				},
				"rg_acl": schema.ListNestedAttribute{
					Computed: true,
					NestedObject: schema.NestedAttributeObject{
						Attributes: map[string]schema.Attribute{
							"explicit": schema.BoolAttribute{
								Computed: true,
							},
							"guid": schema.StringAttribute{
								Computed: true,
							},
							"right": schema.StringAttribute{
								Computed: true,
							},
							"status": schema.StringAttribute{
								Computed: true,
							},
							"type": schema.StringAttribute{
								Computed: true,
							},
							"user_group_id": schema.StringAttribute{
								Computed: true,
							},
						},
					},
				},
			},
		},
		"account_id": schema.Int64Attribute{
			Computed: true,
		},
		"account_name": schema.StringAttribute{
			Computed: true,
		},
		"bservice_id": schema.Int64Attribute{
			Computed: true,
		},
		"k8sci_id": schema.Int64Attribute{
			Computed: true,
		},
		"created_by": schema.StringAttribute{
			Computed: true,
		},
		"created_time": schema.Int64Attribute{
			Computed: true,
		},
		"deleted_by": schema.StringAttribute{
			Computed: true,
		},
		"deleted_time": schema.Int64Attribute{
			Computed: true,
		},
		"desc": schema.StringAttribute{
			Computed: true,
		},
		"extnet_id": schema.Int64Attribute{
			Computed: true,
		},
		"extnet_only": schema.BoolAttribute{
			Computed: true,
		},
		"ha_mode": schema.BoolAttribute{
			Computed: true,
		},
		"address_vip": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"backend_ip": schema.StringAttribute{
					Computed: true,
				},
				"frontend_ip": schema.StringAttribute{
					Computed: true,
				},
			},
		},
		"k8sci_name": schema.StringAttribute{
			Computed: true,
		},
		"masters": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"cpu": schema.Int64Attribute{
					Computed: true,
				},
				"detailed_info": schema.ListNestedAttribute{
					Computed: true,
					NestedObject: schema.NestedAttributeObject{
						Attributes: map[string]schema.Attribute{
							"compute_id": schema.Int64Attribute{
								Computed: true,
							},
							"name": schema.StringAttribute{
								Computed: true,
							},
							"status": schema.StringAttribute{
								Computed: true,
							},
							"tech_status": schema.StringAttribute{
								Computed: true,
							},
							"interfaces": schema.ListNestedAttribute{
								Computed: true,
								NestedObject: schema.NestedAttributeObject{
									Attributes: map[string]schema.Attribute{
										"def_gw": schema.StringAttribute{
											Computed: true,
										},
										"ip_address": schema.StringAttribute{
											Computed: true,
										},
									},
								},
							},
							"natable_vins_ip": schema.StringAttribute{
								Computed: true,
							},
							"natable_vins_network": schema.StringAttribute{
								Computed: true,
							},
						},
					},
				},
				"disk": schema.Int64Attribute{
					Computed: true,
				},
				"master_group_id": schema.Int64Attribute{
					Computed: true,
				},
				"master_group_name": schema.StringAttribute{
					Computed: true,
				},
				"num": schema.Int64Attribute{
					Computed: true,
				},
				"ram": schema.Int64Attribute{
					Computed: true,
				},
			},
		},
		"workers": schema.ListNestedAttribute{
			Computed: true,
			NestedObject: schema.NestedAttributeObject{
				Attributes: map[string]schema.Attribute{
					"annotations": schema.ListAttribute{
						Computed:    true,
						ElementType: types.StringType,
					},
					"cpu": schema.Int64Attribute{
						Computed: true,
					},
					"detailed_info": schema.ListNestedAttribute{
						Computed: true,
						NestedObject: schema.NestedAttributeObject{
							Attributes: map[string]schema.Attribute{
								"compute_id": schema.Int64Attribute{
									Computed: true,
								},
								"name": schema.StringAttribute{
									Computed: true,
								},
								"status": schema.StringAttribute{
									Computed: true,
								},
								"tech_status": schema.StringAttribute{
									Computed: true,
								},
								"interfaces": schema.ListNestedAttribute{
									Computed: true,
									NestedObject: schema.NestedAttributeObject{
										Attributes: map[string]schema.Attribute{
											"def_gw": schema.StringAttribute{
												Computed: true,
											},
											"ip_address": schema.StringAttribute{
												Computed: true,
											},
										},
									},
								},
								"natable_vins_ip": schema.StringAttribute{
									Computed: true,
								},
								"natable_vins_network": schema.StringAttribute{
									Computed: true,
								},
							},
						},
					},
					"disk": schema.Int64Attribute{
						Computed: true,
					},
					"guid": schema.StringAttribute{
						Computed: true,
					},
					"worker_group_id": schema.Int64Attribute{
						Computed: true,
					},
					"labels": schema.ListAttribute{
						Computed:    true,
						ElementType: types.StringType,
					},
					"worker_group_name": schema.StringAttribute{
						Computed: true,
					},
					"num": schema.Int64Attribute{
						Computed: true,
					},
					"ram": schema.Int64Attribute{
						Computed: true,
					},
					"taints": schema.ListAttribute{
						Computed:    true,
						ElementType: types.StringType,
					},
				},
			},
		},
		"lb_id": schema.Int64Attribute{
			Computed: true,
		},
		"lb_ip": schema.StringAttribute{
			Computed: true,
		},
		"name": schema.StringAttribute{
			Computed: true,
		},
		"network_plugin": schema.StringAttribute{
			Computed: true,
		},
		"rg_id": schema.Int64Attribute{
			Computed: true,
		},
		"rg_name": schema.StringAttribute{
			Computed: true,
		},
		"status": schema.StringAttribute{
			Computed: true,
		},
		"tech_status": schema.StringAttribute{
			Computed: true,
		},
		"updated_by": schema.StringAttribute{
			Computed: true,
		},
		"updated_time": schema.Int64Attribute{
			Computed: true,
		},
		"kubeconfig": schema.StringAttribute{
			Computed: true,
		},
		"vins_id": schema.Int64Attribute{
			Computed: true,
		},
	}
}
