package schemas

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

func MakeSchemaDataSourceExtNetComputesList() map[string]schema.Attribute {
	return map[string]schema.Attribute{
		// required attributes
		"account_id": schema.Int64Attribute{
			Required:    true,
			Description: "find by account id",
		},

		// optional attributes
		"rg_id": schema.Int64Attribute{
			Optional:    true,
			Description: "find by rg id",
		},
		"compute_id": schema.Int64Attribute{
			Optional:    true,
			Description: "find by compute id",
		},
		"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{
					"account_id": schema.Int64Attribute{
						Computed: true,
					},
					"account_name": schema.StringAttribute{
						Computed: true,
					},
					"extnets": schema.ListNestedAttribute{
						Computed: true,
						NestedObject: schema.NestedAttributeObject{
							Attributes: map[string]schema.Attribute{
								"net_id": schema.Int64Attribute{
									Computed: true,
								},
								"ipaddr": schema.StringAttribute{
									Computed: true,
								},
								"ipcidr": schema.StringAttribute{
									Computed: true,
								},
								"name": schema.StringAttribute{
									Computed: true,
								},
							},
						},
					},
					"id": schema.Int64Attribute{
						Computed: true,
					},
					"name": schema.StringAttribute{
						Computed: true,
					},
					"rg_id": schema.Int64Attribute{
						Computed: true,
					},
					"rg_name": schema.StringAttribute{
						Computed: true,
					},
				},
			},
		},
		"entry_count": schema.Int64Attribute{
			Computed: true,
		},
	}
}
