package node

import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

func dataSourceNodeSchemaMake() map[string]*schema.Schema {
	return map[string]*schema.Schema{
		"node_id": {
			Type:        schema.TypeInt,
			Required:    true,
			Description: "node id",
		},
		"auto_start": {
			Type:     schema.TypeBool,
			Computed: true,
		},
		"auto_start_count": {
			Type:     schema.TypeInt,
			Computed: true,
		},
		"consumption": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"consumed": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"ram": {
									Type:     schema.TypeInt,
									Computed: true,
								},
								"computes": {
									Type:     schema.TypeInt,
									Computed: true,
								},
								"routers": {
									Type:     schema.TypeInt,
									Computed: true,
								},
								"vcpu": {
									Type:     schema.TypeInt,
									Computed: true,
								},
							},
						},
					},
					"free": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"vcpu": {
									Type:     schema.TypeFloat,
									Computed: true,
								},
								"ram": {
									Type:     schema.TypeInt,
									Computed: true,
								},
							},
						},
					},
					"reserved": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"ram": {
									Type:     schema.TypeInt,
									Computed: true,
								},
							},
						},
					},
					"total": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"ram": {
									Type:     schema.TypeInt,
									Computed: true,
								},
							},
						},
					},
					"hostname": {
						Type:     schema.TypeString,
						Computed: true,
					},
				},
			},
		},
		"cpu_info": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"clock_speed": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"core_count": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"phys_count": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"flags": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeString,
						},
					},
					"model_name": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"thread_count": {
						Type:     schema.TypeInt,
						Computed: true,
					},
				},
			},
		},
		"cpu_allocation_ratio": {
			Type:     schema.TypeFloat,
			Computed: true,
		},
		"mem_allocation_ratio": {
			Type:     schema.TypeFloat,
			Computed: true,
		},
		"description": {
			Type:     schema.TypeString,
			Computed: true,
		},
		"dpdk": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"bridges": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"backplane1": {
									Type:     schema.TypeList,
									Computed: true,
									Elem: &schema.Resource{
										Schema: map[string]*schema.Schema{
											"interfaces": {
												Type:     schema.TypeList,
												Computed: true,
												Elem: &schema.Schema{
													Type: schema.TypeString,
												},
											},
											"numa_node": {
												Type:     schema.TypeInt,
												Computed: true,
											},
										},
									},
								},
							},
						},
					},
					"hp_memory": {
						Type:     schema.TypeMap,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeInt,
						},
					},
					"pmd_cpu": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeInt,
						},
					},
				},
			},
		},
		"gid": {
			Type:     schema.TypeInt,
			Computed: true,
		},
		"ipaddr": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Schema{
				Type: schema.TypeString,
			},
		},
		"isolated_cpus": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Schema{
				Type: schema.TypeString,
			},
		},
		"name": {
			Type:     schema.TypeString,
			Computed: true,
		},
		"need_reboot": {
			Type:     schema.TypeBool,
			Computed: true,
		},
		"net_addr": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"ip": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeString,
						},
					},
					"name": {
						Type:     schema.TypeString,
						Computed: true,
					},
				},
			},
		},
		"usable_cpus": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Schema{
				Type: schema.TypeString,
			},
		},
		"network_mode": {
			Type:     schema.TypeString,
			Computed: true,
		},
		"openvswitch_bridges": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Schema{
				Type: schema.TypeString,
			},
		},
		"nic_info": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"driver": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"max_vfs": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"numa_node": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"num_vfs": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"os_name": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"pci_slot": {
						Type:     schema.TypeString,
						Computed: true,
					},

					"vf_list": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"fn_id": {
									Type:     schema.TypeInt,
									Computed: true,
								},
								"pci_slot": {
									Type:     schema.TypeString,
									Computed: true,
								},
							},
						},
					},
				},
			},
		},
		"numa_topology": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"node_num": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"nodes": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"cpu_list": {
									Type:     schema.TypeList,
									Computed: true,
									Elem: &schema.Schema{
										Type: schema.TypeInt,
									},
								},
								"memory": {
									Type:     schema.TypeList,
									Computed: true,
									Elem: &schema.Resource{
										Schema: map[string]*schema.Schema{
											"one_g": {
												Type:     schema.TypeInt,
												Computed: true,
											},
											"two_m": {
												Type:     schema.TypeInt,
												Computed: true,
											},
											"total": {
												Type:     schema.TypeInt,
												Computed: true,
											},
										},
									},
								},
							},
						},
					},
				},
			},
		},
		"reserved_cpus": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Schema{
				Type: schema.TypeString,
			},
		},
		"roles": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Schema{
				Type: schema.TypeString,
			},
		},
		"sdn_hypervisor_name": {
			Type:     schema.TypeString,
			Computed: true,
		},
		"sriov_enabled": {
			Type:     schema.TypeBool,
			Computed: true,
		},
		"status": {
			Type:     schema.TypeString,
			Computed: true,
		},
		"to_active": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"actor": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"reason": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"time": {
						Type:     schema.TypeInt,
						Computed: true,
					},
				},
			},
		},
		"to_installing": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"actor": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"reason": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"time": {
						Type:     schema.TypeInt,
						Computed: true,
					},
				},
			},
		},
		"to_maintenance": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"actor": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"reason": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"time": {
						Type:     schema.TypeInt,
						Computed: true,
					},
				},
			},
		},
		"to_restricted": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"actor": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"reason": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"time": {
						Type:     schema.TypeInt,
						Computed: true,
					},
				},
			},
		},
		"version": {
			Type:     schema.TypeString,
			Computed: true,
		},
		"zone_id": {
			Type:     schema.TypeInt,
			Computed: true,
		},
	}
}

func dataSourceNodeListSchemaMake() map[string]*schema.Schema {
	return map[string]*schema.Schema{
		"by_id": {
			Type:        schema.TypeInt,
			Optional:    true,
			Description: "find node by id",
		},
		"name": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "find node by name",
		},
		"version": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "find node by version",
		},
		"release": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "find node by release",
		},
		"sep_id": {
			Type:        schema.TypeInt,
			Optional:    true,
			Description: "find node by sepId",
		},
		"role": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "find node by role",
		},
		"status": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "find node by status",
		},
		"zone_id": {
			Type:        schema.TypeInt,
			Optional:    true,
			Description: "find node by zone id",
		},
		"sort_by": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "sort by one of supported fields, format +|-(field)",
		},
		"page": {
			Type:        schema.TypeInt,
			Optional:    true,
			Description: "page number",
		},
		"size": {
			Type:        schema.TypeInt,
			Optional:    true,
			Description: "page size",
		},

		"items": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"additional_pkgs": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeString,
						},
					},
					"api_url": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"auto_start": {
						Type:     schema.TypeBool,
						Computed: true,
					},
					"auto_start_count": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"cpu_allocation_ratio": {
						Type:     schema.TypeFloat,
						Computed: true,
					},
					"cpu_info": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"clock_speed": {
									Type:     schema.TypeFloat,
									Computed: true,
								},
								"core_count": {
									Type:     schema.TypeInt,
									Computed: true,
								},
								"phys_count": {
									Type:     schema.TypeInt,
									Computed: true,
								},
								"flags": {
									Type:     schema.TypeList,
									Computed: true,
									Elem: &schema.Schema{
										Type: schema.TypeString,
									},
								},
								"model_name": {
									Type:     schema.TypeString,
									Computed: true,
								},
								"thread_count": {
									Type:     schema.TypeInt,
									Computed: true,
								},
							},
						},
					},
					"description": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"drivers": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeString,
						},
					},
					"dpdk": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"bridges": {
									Type:     schema.TypeList,
									Computed: true,
									Elem: &schema.Resource{
										Schema: map[string]*schema.Schema{
											"backplane1": {
												Type:     schema.TypeList,
												Computed: true,
												Elem: &schema.Resource{
													Schema: map[string]*schema.Schema{
														"interfaces": {
															Type:     schema.TypeList,
															Computed: true,
															Elem: &schema.Schema{
																Type: schema.TypeString,
															},
														},
														"numa_node": {
															Type:     schema.TypeInt,
															Computed: true,
														},
													},
												},
											},
										},
									},
								},
								"hp_memory": {
									Type:     schema.TypeMap,
									Computed: true,
									Elem: &schema.Schema{
										Type: schema.TypeInt,
									},
								},
								"pmd_cpu": {
									Type:     schema.TypeList,
									Computed: true,
									Elem: &schema.Schema{
										Type: schema.TypeInt,
									},
								},
							},
						},
					},
					"gid": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"guid": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"hostkey": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"node_id": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"ipaddr": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeString,
						},
					},
					"isolated_cpus": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeString,
						},
					},
					"lastcheck": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"machine_guid": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"mainboard_sn": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"mem_allocation_ratio": {
						Type:     schema.TypeFloat,
						Computed: true,
					},
					"memory": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"milestones": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"model": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"name": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"need_reboot": {
						Type:     schema.TypeBool,
						Computed: true,
					},
					"net_addr": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"cidr": {
									Type:     schema.TypeList,
									Computed: true,
									Elem: &schema.Schema{
										Type: schema.TypeString,
									},
								},
								"index": {
									Type:     schema.TypeInt,
									Computed: true,
								},
								"ip": {
									Type:     schema.TypeList,
									Computed: true,
									Elem: &schema.Schema{
										Type: schema.TypeString,
									},
								},
								"mac": {
									Type:     schema.TypeString,
									Computed: true,
								},
								"mtu": {
									Type:     schema.TypeInt,
									Computed: true,
								},
								"name": {
									Type:     schema.TypeString,
									Computed: true,
								},
							},
						},
					},
					"network_mode": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"old_compat_lvm_id": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"openvswitch_bridges": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeString,
						},
					},
					"nic_info": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"driver": {
									Type:     schema.TypeString,
									Computed: true,
								},
								"max_vfs": {
									Type:     schema.TypeInt,
									Computed: true,
								},
								"numa_node": {
									Type:     schema.TypeInt,
									Computed: true,
								},
								"num_vfs": {
									Type:     schema.TypeInt,
									Computed: true,
								},
								"os_name": {
									Type:     schema.TypeString,
									Computed: true,
								},
								"pci_slot": {
									Type:     schema.TypeString,
									Computed: true,
								},

								"vf_list": {
									Type:     schema.TypeList,
									Computed: true,
									Elem: &schema.Resource{
										Schema: map[string]*schema.Schema{
											"fn_id": {
												Type:     schema.TypeInt,
												Computed: true,
											},
											"pci_slot": {
												Type:     schema.TypeString,
												Computed: true,
											},
										},
									},
								},
							},
						},
					},
					"node_uuid": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"numa_topology": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"node_num": {
									Type:     schema.TypeInt,
									Computed: true,
								},
								"nodes": {
									Type:     schema.TypeList,
									Computed: true,
									Elem: &schema.Resource{
										Schema: map[string]*schema.Schema{
											"cpu_list": {
												Type:     schema.TypeList,
												Computed: true,
												Elem: &schema.Schema{
													Type: schema.TypeInt,
												},
											},
											"memory": {
												Type:     schema.TypeList,
												Computed: true,
												Elem: &schema.Resource{
													Schema: map[string]*schema.Schema{
														"one_g": {
															Type:     schema.TypeInt,
															Computed: true,
														},
														"two_m": {
															Type:     schema.TypeInt,
															Computed: true,
														},
														"total": {
															Type:     schema.TypeInt,
															Computed: true,
														},
													},
												},
											},
										},
									},
								},
							},
						},
					},
					"packages": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"ver": {
									Type:     schema.TypeString,
									Computed: true,
								},
								"size": {
									Type:     schema.TypeString,
									Computed: true,
								},
							},
						},
					},
					"peer_backup": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"peer_log": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"peer_stats": {
						Type:     schema.TypeInt,
						Computed: true,
					},
					"pgpus": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeInt,
						},
					},
					"public_keys": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeString,
						},
					},
					"release": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"reserved_cpus": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeString,
						},
					},
					"roles": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeString,
						},
					},
					"sdn_hypervisor_name": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"seps": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeInt,
						},
					},
					"serial_num": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"sriov_enabled": {
						Type:     schema.TypeBool,
						Computed: true,
					},
					"status": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"tags": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeString,
						},
					},
					"type": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"uefi_firmware_file": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"usable_cpus": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeString,
						},
					},
					"version": {
						Type:     schema.TypeString,
						Computed: true,
					},
					"zone_id": {
						Type:     schema.TypeInt,
						Computed: true,
					},
				},
			},
		},
		"entry_count": {
			Type:        schema.TypeInt,
			Computed:    true,
			Description: "entry count",
		},
	}
}
