package schemas

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

func MakeSchemaDataSourceDiskListUnattached() map[string]schema.Attribute {
	return map[string]schema.Attribute{
		// optional attributes
		"by_id": schema.Int64Attribute{
			Optional:    true,
			Description: "Find by ID",
		},
		"account_name": schema.StringAttribute{
			Optional:    true,
			Description: "Find by account name",
		},
		"disk_max_size": schema.Int64Attribute{
			Optional:    true,
			Description: "Find by max disk size",
		},
		"status": schema.StringAttribute{
			Optional:    true,
			Description: "Find by status",
		},
		"account_id": schema.Int64Attribute{
			Optional:    true,
			Description: "ID of the account the disks belong to",
		},
		"sep_id": schema.Int64Attribute{
			Optional:    true,
			Description: "find by sep ID",
		},
		"pool_name": schema.StringAttribute{
			Optional:    true,
			Description: "find by pool name",
		},
		"type": schema.StringAttribute{
			Optional:    true,
			Description: "type of the disks",
		},
		"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: "Page size",
		},

		// computed attributes
		"id": schema.StringAttribute{
			Computed: true,
		},
		"items": schema.ListNestedAttribute{
			Computed: true,
			NestedObject: schema.NestedAttributeObject{
				Attributes: map[string]schema.Attribute{
					"ckey": schema.StringAttribute{
						Computed: true,
					},
					"meta": schema.ListAttribute{
						Computed:    true,
						ElementType: types.StringType,
					},
					"account_id": schema.Int64Attribute{
						Computed: true,
					},
					"account_name": schema.StringAttribute{
						Computed: true,
					},
					"acl": schema.StringAttribute{
						Computed: true,
					},
					"boot_partition": schema.Int64Attribute{
						Computed: true,
					},
					"created_time": schema.Int64Attribute{
						Computed: true,
					},
					"deleted_time": schema.Int64Attribute{
						Computed: true,
					},
					"desc": schema.StringAttribute{
						Computed: true,
					},
					"destruction_time": schema.Int64Attribute{
						Computed: true,
					},
					"disk_path": schema.StringAttribute{
						Computed: true,
					},
					"gid": schema.Int64Attribute{
						Computed: true,
					},
					"guid": schema.Int64Attribute{
						Computed: true,
					},
					"disk_id": schema.Int64Attribute{
						Computed: true,
					},
					"image_id": schema.Int64Attribute{
						Computed: true,
					},
					"images": schema.ListAttribute{
						Computed:    true,
						ElementType: types.Int64Type,
					},
					"iotune": schema.SingleNestedAttribute{
						Computed: true,
						Attributes: map[string]schema.Attribute{
							"read_bytes_sec": schema.Int64Attribute{
								Computed: true,
							},
							"read_bytes_sec_max": schema.Int64Attribute{
								Computed: true,
							},
							"read_iops_sec": schema.Int64Attribute{
								Computed: true,
							},
							"read_iops_sec_max": schema.Int64Attribute{
								Computed: true,
							},
							"size_iops_sec": schema.Int64Attribute{
								Computed: true,
							},
							"total_bytes_sec": schema.Int64Attribute{
								Computed: true,
							},
							"total_bytes_sec_max": schema.Int64Attribute{
								Computed: true,
							},
							"total_iops_sec": schema.Int64Attribute{
								Computed: true,
							},
							"total_iops_sec_max": schema.Int64Attribute{
								Computed: true,
							},
							"write_bytes_sec": schema.Int64Attribute{
								Computed: true,
							},
							"write_bytes_sec_max": schema.Int64Attribute{
								Computed: true,
							},
							"write_iops_sec": schema.Int64Attribute{
								Computed: true,
							},
							"write_iops_sec_max": schema.Int64Attribute{
								Computed: true,
							},
						},
					},
					"iqn": schema.StringAttribute{
						Computed: true,
					},
					"login": schema.StringAttribute{
						Computed: true,
					},
					"milestones": schema.Int64Attribute{
						Computed: true,
					},
					"disk_name": schema.StringAttribute{
						Computed: true,
					},
					"order": schema.Int64Attribute{
						Computed: true,
					},
					"params": schema.StringAttribute{
						Computed: true,
					},
					"parent_id": schema.Int64Attribute{
						Computed: true,
					},
					"passwd": schema.StringAttribute{
						Computed: true,
					},
					"pci_slot": schema.Int64Attribute{
						Computed: true,
					},
					"pool": schema.StringAttribute{
						Computed: true,
					},
					"purge_attempts": schema.Int64Attribute{
						Computed: true,
					},
					"purge_time": schema.Int64Attribute{
						Computed: true,
					},
					"reality_device_number": schema.Int64Attribute{
						Computed: true,
					},
					"reference_id": schema.StringAttribute{
						Computed: true,
					},
					"res_id": schema.StringAttribute{
						Computed: true,
					},
					"res_name": schema.StringAttribute{
						Computed: true,
					},
					"role": schema.StringAttribute{
						Computed: true,
					},
					"sep_id": schema.Int64Attribute{
						Computed: true,
					},
					"shareable": schema.BoolAttribute{
						Computed: true,
					},
					"size_max": schema.Int64Attribute{
						Computed: true,
					},
					"size_used": schema.Float64Attribute{
						Computed: true,
					},
					"snapshots": schema.ListNestedAttribute{
						Computed: true,
						NestedObject: schema.NestedAttributeObject{
							Attributes: map[string]schema.Attribute{
								"guid": schema.StringAttribute{
									Computed: true,
								},
								"label": schema.StringAttribute{
									Computed: true,
								},
								"res_id": schema.StringAttribute{
									Computed: true,
								},
								"snap_set_guid": schema.StringAttribute{
									Computed: true,
								},
								"snap_set_time": schema.Int64Attribute{
									Computed: true,
								},
								"timestamp": schema.Int64Attribute{
									Computed: true,
								},
							},
						},
					},
					"status": schema.StringAttribute{
						Computed: true,
					},
					"tech_status": schema.StringAttribute{
						Computed: true,
					},
					"type": schema.StringAttribute{
						Computed: true,
					},
					"vmid": schema.Int64Attribute{
						Computed: true,
					},
				},
			},
		},
		"entry_count": schema.Int64Attribute{
			Computed: true,
		},
	}
}
