package schemas

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

func MakeSchemaDataSourceAccountRGList() map[string]schema.Attribute {
	return map[string]schema.Attribute{
		// required attributes
		"account_id": schema.Int64Attribute{
			Required:    true,
			Description: "ID of the account",
		},

		// optional attributes
		"rg_id": schema.Int64Attribute{
			Optional:    true,
			Description: "find by rg id",
		},
		"vins_id": schema.Int64Attribute{
			Optional:    true,
			Description: "find by vins id",
		},
		"vm_id": schema.Int64Attribute{
			Optional:    true,
			Description: "find by vm id",
		},
		"name": schema.StringAttribute{
			Optional:    true,
			Description: "find by name",
		},
		"status": schema.StringAttribute{
			Optional:    true,
			Description: "find 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{
					"computes": schema.SingleNestedAttribute{
						Computed: true,
						Attributes: map[string]schema.Attribute{
							"started": schema.Int64Attribute{
								Computed: true,
							},
							"stopped": schema.Int64Attribute{
								Computed: true,
							},
						},
					},
					"resources": schema.SingleNestedAttribute{
						Computed: true,
						Attributes: map[string]schema.Attribute{
							"consumed": schema.SingleNestedAttribute{
								Computed: true,
								Attributes: map[string]schema.Attribute{
									"cpu": schema.Int64Attribute{
										Computed: true,
									},
									"disksize": schema.Int64Attribute{
										Computed: true,
									},
									"disksizemax": schema.Int64Attribute{
										Computed: true,
									},
									"extips": schema.Int64Attribute{
										Computed: true,
									},
									"exttraffic": schema.Int64Attribute{
										Computed: true,
									},
									"gpu": schema.Int64Attribute{
										Computed: true,
									},
									"ram": schema.Int64Attribute{
										Computed: true,
									},
									"seps": schema.ListNestedAttribute{
										Computed: true,
										NestedObject: schema.NestedAttributeObject{
											Attributes: map[string]schema.Attribute{
												"sep_id": schema.StringAttribute{
													Computed: true,
												},
												"pool_name": schema.StringAttribute{
													Computed: true,
												},
												"disksize": schema.Float64Attribute{
													Computed: true,
												},
												"disksizemax": schema.Float64Attribute{
													Computed: true,
												},
											},
										},
									},
								},
							},
							"limits": schema.SingleNestedAttribute{
								Computed: true,
								Attributes: map[string]schema.Attribute{
									"cpu": schema.Int64Attribute{
										Computed: true,
									},
									"disksize": schema.Int64Attribute{
										Computed: true,
									},
									"disksizemax": schema.Int64Attribute{
										Computed: true,
									},
									"extips": schema.Int64Attribute{
										Computed: true,
									},
									"exttraffic": schema.Int64Attribute{
										Computed: true,
									},
									"gpu": schema.Int64Attribute{
										Computed: true,
									},
									"ram": schema.Int64Attribute{
										Computed: true,
									},
									"seps": schema.Int64Attribute{
										Computed: true,
									},
								},
							},
							"reserved": schema.SingleNestedAttribute{
								Computed: true,
								Attributes: map[string]schema.Attribute{
									"cpu": schema.Int64Attribute{
										Computed: true,
									},
									"disksize": schema.Float64Attribute{
										Computed: true,
									},
									"disksizemax": schema.Float64Attribute{
										Computed: true,
									},
									"extips": schema.Int64Attribute{
										Computed: true,
									},
									"exttraffic": schema.Int64Attribute{
										Computed: true,
									},
									"gpu": schema.Int64Attribute{
										Computed: true,
									},
									"ram": schema.Int64Attribute{
										Computed: true,
									},
									"seps": schema.ListNestedAttribute{
										Computed: true,
										NestedObject: schema.NestedAttributeObject{
											Attributes: map[string]schema.Attribute{
												"sep_id": schema.StringAttribute{
													Computed: true,
												},
												"pool_name": schema.StringAttribute{
													Computed: true,
												},
												"disksize": schema.Float64Attribute{
													Computed: true,
												},
												"disksizemax": schema.Float64Attribute{
													Computed: true,
												},
											},
										},
									},
								},
							},
						},
					},
					"created_by": schema.StringAttribute{
						Computed: true,
					},
					"created_time": schema.Int64Attribute{
						Computed: true,
					},
					"deleted_by": schema.StringAttribute{
						Computed: true,
					},
					"deleted_time": schema.Int64Attribute{
						Computed: true,
					},
					"desc": schema.StringAttribute{
						Computed: true,
					},
					"rg_id": schema.Int64Attribute{
						Computed: true,
					},
					"milestones": schema.Int64Attribute{
						Computed: true,
					},
					"rg_name": schema.StringAttribute{
						Computed: true,
					},
					"status": schema.StringAttribute{
						Computed: true,
					},
					"updated_by": schema.StringAttribute{
						Computed: true,
					},
					"updated_time": schema.Int64Attribute{
						Computed: true,
					},
					"vinses": schema.Int64Attribute{
						Computed: true,
					},
				},
			},
		},
		"entry_count": schema.Int64Attribute{
			Computed: true,
		},
	}
}
