package schemas

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

func MakeSchemaDataSourceAccountList() map[string]schema.Attribute {
	return map[string]schema.Attribute{
		// optional attributes
		"by_id": schema.Int64Attribute{
			Optional:    true,
			Description: "filter by id",
		},
		"name": schema.StringAttribute{
			Optional:    true,
			Description: "filter by name",
		},
		"acl": schema.StringAttribute{
			Optional:    true,
			Description: "filter by acl",
		},
		"status": schema.StringAttribute{
			Optional:    true,
			Description: "filter by status",
		},
		"page": schema.Int64Attribute{
			Optional:    true,
			Description: "page number",
		},
		"size": schema.Int64Attribute{
			Optional:    true,
			Description: "page size",
		},
		"sort_by": schema.StringAttribute{
			Optional:    true,
			Description: "sort by one of supported fields, format +|-(field)",
		},

		// computed attributes
		"id": schema.StringAttribute{
			Computed: true,
		},
		"items": schema.ListNestedAttribute{
			Computed: true,
			NestedObject: schema.NestedAttributeObject{
				Attributes: map[string]schema.Attribute{
					"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,
								},
							},
						},
					},
					"compute_features": schema.ListAttribute{
						Computed:    true,
						ElementType: types.StringType,
					},
					"created_time": schema.Int64Attribute{
						Computed: true,
					},
					"deleted_time": schema.Int64Attribute{
						Computed: true,
					},
					"account_id": schema.Int64Attribute{
						Computed: true,
					},
					"desc": schema.StringAttribute{
						Computed: true,
					},
					"account_name": schema.StringAttribute{
						Computed: true,
					},
					"status": schema.StringAttribute{
						Computed: true,
					},
					"updated_time": schema.Int64Attribute{
						Computed: true,
					},
				},
			},
		},
		"entry_count": schema.Int64Attribute{
			Computed: true,
		},
	}
}
