package schemas

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

func MakeSchemaDataSourceNode() map[string]schema.Attribute {
	return map[string]schema.Attribute{
		"node_id": schema.Int64Attribute{
			Required: true,
		},
		"consumption": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"consumed": schema.SingleNestedAttribute{
					Computed: true,
					Attributes: map[string]schema.Attribute{
						"ram": schema.Int64Attribute{
							Computed: true,
						},
						"computes": schema.Int64Attribute{
							Computed: true,
						},
						"routers": schema.Int64Attribute{
							Computed: true,
						},
						"vcpu": schema.Int64Attribute{
							Computed: true,
						},
					},
				},
				"free": schema.SingleNestedAttribute{
					Computed: true,
					Attributes: map[string]schema.Attribute{
						"ram": schema.Int64Attribute{
							Computed: true,
						},
					},
				},
				"reserved": schema.SingleNestedAttribute{
					Computed: true,
					Attributes: map[string]schema.Attribute{
						"ram": schema.Int64Attribute{
							Computed: true,
						},
					},
				},
				"total": schema.SingleNestedAttribute{
					Computed: true,
					Attributes: map[string]schema.Attribute{
						"ram": schema.Int64Attribute{
							Computed: true,
						},
					},
				},
				"hostname": schema.StringAttribute{
					Computed: true,
				},
			},
		},
		"cpu_info": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"clock_speed": schema.Int64Attribute{
					Computed: true,
				},
				"core_count": schema.Int64Attribute{
					Computed: true,
				},
				"phys_count": schema.Int64Attribute{
					Computed: true,
				},
			},
		},
		"cpu_allocation_ratio": schema.Int64Attribute{
			Computed: true,
		},
		"dpdk": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"bridges": schema.SingleNestedAttribute{
					Computed: true,
					Attributes: map[string]schema.Attribute{
						"backplane1": schema.SingleNestedAttribute{
							Computed: true,
							Attributes: map[string]schema.Attribute{
								"interfaces": schema.ListAttribute{
									Computed:    true,
									ElementType: types.StringType,
								},
								"numa_node": schema.Int64Attribute{
									Computed: true,
								},
							},
						},
					},
				},
				"hp_memory": schema.MapAttribute{
					Computed:    true,
					ElementType: types.Int64Type,
				},
				"pmd_cpu": schema.ListAttribute{
					Computed:    true,
					ElementType: types.Int64Type,
				},
			},
		},
		"gid": schema.Int64Attribute{
			Computed: true,
		},
		"id": schema.StringAttribute{
			Computed: true,
		},
		"ipaddr": schema.ListAttribute{
			Computed:    true,
			ElementType: types.StringType,
		},
		"isolated_cpus": schema.ListAttribute{
			Computed:    true,
			ElementType: types.Int64Type,
		},
		"name": schema.StringAttribute{
			Computed: true,
		},
		"need_reboot": schema.BoolAttribute{
			Computed: true,
		},
		"network_mode": schema.StringAttribute{
			Computed: true,
		},
		"nic_info": schema.ListNestedAttribute{
			Computed: true,
			NestedObject: schema.NestedAttributeObject{
				Attributes: map[string]schema.Attribute{
					"driver": schema.StringAttribute{
						Computed: true,
					},
					"max_vfs": schema.Int64Attribute{
						Computed: true,
					},
					"numa_node": schema.Int64Attribute{
						Computed: true,
					},
					"num_vfs": schema.Int64Attribute{
						Computed: true,
					},
					"os_name": schema.StringAttribute{
						Computed: true,
					},
					"pci_slot": schema.StringAttribute{
						Computed: true,
					},
					"vf_list": schema.ListNestedAttribute{
						Computed: true,
						NestedObject: schema.NestedAttributeObject{
							Attributes: map[string]schema.Attribute{
								"fn_id": schema.Int64Attribute{
									Computed: true,
								},
								"pci_slot": schema.StringAttribute{
									Computed: true,
								},
							},
						},
					},
				},
			},
		},
		"numa_topology": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"node_num": schema.Int64Attribute{
					Computed: true,
				},
				"nodes": schema.ListNestedAttribute{
					Computed: true,
					NestedObject: schema.NestedAttributeObject{
						Attributes: map[string]schema.Attribute{
							"cpu_list": schema.ListAttribute{
								Computed:    true,
								ElementType: types.Int64Type,
							},
							"memory": schema.SingleNestedAttribute{
								Computed: true,
								Attributes: map[string]schema.Attribute{
									"one_g": schema.Int64Attribute{
										Computed: true,
									},
									"two_m": schema.Int64Attribute{
										Computed: true,
									},
									"total": schema.Int64Attribute{
										Computed: true,
									},
								},
							},
						},
					},
				},
			},
		},
		"reserved_cpus": schema.ListAttribute{
			Computed:    true,
			ElementType: types.Int64Type,
		},
		"roles": schema.ListAttribute{
			Computed:    true,
			ElementType: types.StringType,
		},
		"sriov_enabled": schema.BoolAttribute{
			Computed: true,
		},
		"stack_id": schema.Int64Attribute{
			Computed: true,
		},
		"status": schema.StringAttribute{
			Computed: true,
		},
		"to_active": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"actor": schema.StringAttribute{
					Computed: true,
				},
				"reason": schema.StringAttribute{
					Computed: true,
				},
				"time": schema.Int64Attribute{
					Computed: true,
				},
			},
		},
		"to_installing": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"actor": schema.StringAttribute{
					Computed: true,
				},
				"reason": schema.StringAttribute{
					Computed: true,
				},
				"time": schema.Int64Attribute{
					Computed: true,
				},
			},
		},
		"to_maintenance": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"actor": schema.StringAttribute{
					Computed: true,
				},
				"reason": schema.StringAttribute{
					Computed: true,
				},
				"time": schema.Int64Attribute{
					Computed: true,
				},
			},
		},
		"to_restricted": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"actor": schema.StringAttribute{
					Computed: true,
				},
				"reason": schema.StringAttribute{
					Computed: true,
				},
				"time": schema.Int64Attribute{
					Computed: true,
				},
			},
		},
		"version": schema.StringAttribute{
			Computed: true,
		},
	}
}
