package schemas

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

func MakeSchemaDataSourceImageList() map[string]schema.Attribute {
	return map[string]schema.Attribute{
		// optional attributes
		"sep_id": schema.Int64Attribute{
			Optional: true,
		},
		"by_id": schema.Int64Attribute{
			Optional: true,
		},
		"name": schema.StringAttribute{
			Optional: true,
		},
		"status": schema.StringAttribute{
			Optional: true,
		},
		"architecture": schema.StringAttribute{
			Optional: true,
		},
		"type_image": schema.StringAttribute{
			Optional: true,
		},
		"image_size": schema.Int64Attribute{
			Optional: true,
		},
		"sep_name": schema.StringAttribute{
			Optional: true,
		},
		"pool_name": schema.StringAttribute{
			Optional: true,
		},
		"public": schema.BoolAttribute{
			Optional: true,
		},
		"hot_resize": schema.BoolAttribute{
			Optional: true,
		},
		"bootable": schema.BoolAttribute{
			Optional: true,
		},
		"sort_by": schema.StringAttribute{
			Optional:    true,
			Description: "sort by one of supported fields, format +|-(field)",
		},
		"page": schema.Int64Attribute{
			Optional: true,
		},
		"size": schema.Int64Attribute{
			Optional: true,
		},
		"enabled": schema.BoolAttribute{
			Optional: true,
		},
		// computed attributes
		"id": schema.StringAttribute{
			Computed: true,
		},
		"items": schema.ListNestedAttribute{
			Computed: true,
			NestedObject: schema.NestedAttributeObject{
				Attributes: map[string]schema.Attribute{
					"account_id": schema.Int64Attribute{
						Computed: true,
					},
					"architecture": schema.StringAttribute{
						Computed: true,
					},
					"boot_type": schema.StringAttribute{
						Computed: true,
					},
					"bootable": schema.BoolAttribute{
						Computed: true,
					},
					"cdrom": schema.BoolAttribute{
						Computed: true,
					},
					"desc": schema.StringAttribute{
						Computed: true,
					},
					"drivers": schema.ListAttribute{
						Computed:    true,
						ElementType: types.StringType,
					},
					"hot_resize": schema.BoolAttribute{
						Computed: true,
					},
					"image_id": schema.Int64Attribute{
						Computed: true,
					},
					"image_type": schema.StringAttribute{
						Computed: true,
					},
					"link_to": schema.Int64Attribute{
						Computed: true,
					},
					"image_name": schema.StringAttribute{
						Computed: true,
					},
					"pool_name": schema.StringAttribute{
						Computed: true,
					},
					"sep_id": schema.Int64Attribute{
						Computed: true,
					},
					"size": schema.Int64Attribute{
						Computed: true,
					},
					"status": schema.StringAttribute{
						Computed: true,
					},
					"network_interface_naming": schema.StringAttribute{
						Computed: true,
					},
					"username": schema.StringAttribute{
						Computed: true,
					},
					"virtual": schema.BoolAttribute{
						Computed: true,
					},
				},
			},
		},
		"entry_count": schema.Int64Attribute{
			Computed: true,
		},
	}
}
