package schemas

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

func MakeSchemaDataSourceK8ciList() map[string]schema.Attribute {
	return map[string]schema.Attribute{
		// optional attributes
		"by_id": schema.Int64Attribute{
			Optional: true,
		},
		"name": schema.StringAttribute{
			Optional: true,
		},
		"status": schema.StringAttribute{
			Optional: true,
		},
		"worker_driver": schema.StringAttribute{
			Optional: true,
		},
		"master_driver": schema.StringAttribute{
			Optional: true,
		},
		"network_plugins": schema.StringAttribute{
			Optional: true,
		},
		"include_disabled": 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,
		},
		// computed attributes
		"id": schema.StringAttribute{
			Computed: true,
		},
		"items": schema.ListNestedAttribute{
			Computed: true,
			NestedObject: schema.NestedAttributeObject{
				Attributes: map[string]schema.Attribute{
					"k8ci_id": schema.Int64Attribute{
						Computed: true,
					},
					"k8ci_name": schema.StringAttribute{
						Computed: true,
					},
					"lb_image_id": schema.Int64Attribute{
						Computed: true,
					},
					"network_plugins": schema.ListAttribute{
						Computed:    true,
						ElementType: types.StringType,
					},
					"status": schema.StringAttribute{
						Computed: true,
					},
					"desc": schema.StringAttribute{
						Computed: true,
					},
					"created_time": schema.Int64Attribute{
						Computed: true,
					},
					"version": schema.StringAttribute{
						Computed: true,
					},
				},
			},
		},
		"entry_count": schema.Int64Attribute{
			Computed: true,
		},
	}
}
