package schemas

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

func MakeSchemaDataSourceRGListComputes() map[string]schema.Attribute {
	return map[string]schema.Attribute{
		// required attributes
		"rg_id": schema.Int64Attribute{
			Required:    true,
			Description: "ID of the RG",
		},

		// optional attributes
		"compute_id": schema.Int64Attribute{
			Optional:    true,
			Description: "find by id",
		},
		"name": schema.StringAttribute{
			Optional:    true,
			Description: "find by name",
		},
		"account_id": schema.Int64Attribute{
			Optional:    true,
			Description: "find by account id",
		},
		"tech_status": schema.StringAttribute{
			Optional:    true,
			Description: "find by tech status",
		},
		"status": schema.StringAttribute{
			Optional:    true,
			Description: "find by status",
		},
		"ip_address": schema.StringAttribute{
			Optional:    true,
			Description: "find by ip address",
		},
		"extnet_name": schema.StringAttribute{
			Optional:    true,
			Description: "find by external network name",
		},
		"extnet_id": schema.Int64Attribute{
			Optional:    true,
			Description: "find by external network id",
		},
		"sort_by": schema.StringAttribute{
			Optional:    true,
			Description: "sort by one of supported fields, format +|-(field)",
		},
		"page": schema.Int64Attribute{
			Optional:    true,
			Description: "page number",
		},
		"size": schema.Int64Attribute{
			Optional:    true,
			Description: "size number",
		},

		//computed attributes
		"id": schema.StringAttribute{
			Optional: true,
		},
		"items": schema.ListNestedAttribute{
			Computed: true,
			NestedObject: schema.NestedAttributeObject{
				Attributes: map[string]schema.Attribute{
					"account_id": schema.Int64Attribute{
						Computed: true,
					},
					"account_name": schema.StringAttribute{
						Computed: true,
					},
					"affinity_label": schema.StringAttribute{
						Computed: true,
					},
					"affinity_rules": schema.ListNestedAttribute{
						Computed: true,
						NestedObject: schema.NestedAttributeObject{
							Attributes: map[string]schema.Attribute{
								"guid": schema.StringAttribute{
									Computed: true,
								},
								"key": schema.StringAttribute{
									Computed: true,
								},
								"mode": schema.StringAttribute{
									Computed: true,
								},
								"policy": schema.StringAttribute{
									Computed: true,
								},
								"topology": schema.StringAttribute{
									Computed: true,
								},
								"value": schema.StringAttribute{
									Computed: true,
								},
							},
						},
					},
					"affinity_weight": schema.Int64Attribute{
						Computed: true,
					},
					"antiaffinity_rules": schema.ListNestedAttribute{
						Computed: true,
						NestedObject: schema.NestedAttributeObject{
							Attributes: map[string]schema.Attribute{
								"guid": schema.StringAttribute{
									Computed: true,
								},
								"key": schema.StringAttribute{
									Computed: true,
								},
								"mode": schema.StringAttribute{
									Computed: true,
								},
								"policy": schema.StringAttribute{
									Computed: true,
								},
								"topology": schema.StringAttribute{
									Computed: true,
								},
								"value": schema.StringAttribute{
									Computed: true,
								},
							},
						},
					},
					"cpus": 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,
					},
					"id": schema.Int64Attribute{
						Computed: true,
					},
					"name": schema.StringAttribute{
						Computed: true,
					},
					"ram": schema.Int64Attribute{
						Computed: true,
					},
					"registered": schema.BoolAttribute{
						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,
					},
					"total_disks_size": schema.Int64Attribute{
						Computed: true,
					},
					"updated_by": schema.StringAttribute{
						Computed: true,
					},
					"updated_time": schema.Int64Attribute{
						Computed: true,
					},
					"user_managed": schema.BoolAttribute{
						Computed: true,
					},
					"vins_connected": schema.Int64Attribute{
						Computed: true,
					},
				},
			},
		},
		"entry_count": schema.Int64Attribute{
			Computed: true,
		},
	}
}
