package schemas

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

func MakeSchemaDataSourceVINS() map[string]schema.Attribute {
	return map[string]schema.Attribute{
		// required attributes
		"vins_id": schema.Int64Attribute{
			Required:    true,
			Description: "Unique ID of the ViNS.",
		},

		// computed attributes
		"id": schema.StringAttribute{
			Computed: true,
		},
		"vnf_dev": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"ckey": schema.StringAttribute{
					Computed: true,
				},
				"account_id": schema.Int64Attribute{
					Computed: true,
				},
				"capabilities": schema.ListAttribute{
					Computed:    true,
					ElementType: types.StringType,
				},
				"config": schema.SingleNestedAttribute{
					Computed: true,
					Attributes: map[string]schema.Attribute{
						"mgmt": schema.SingleNestedAttribute{
							Computed: true,
							Attributes: map[string]schema.Attribute{
								"ip_addr": schema.StringAttribute{
									Computed: true,
								},
								"password": schema.StringAttribute{
									Computed: true,
								},
								"ssh_key": schema.StringAttribute{
									Computed: true,
								},
								"user": schema.StringAttribute{
									Computed: true,
								},
							},
						},
						"resources": schema.SingleNestedAttribute{
							Computed: true,
							Attributes: map[string]schema.Attribute{
								"cpu": schema.Int64Attribute{
									Computed: true,
								},
								"ram": schema.Int64Attribute{
									Computed: true,
								},
								"stack_id": schema.Int64Attribute{
									Computed: true,
								},
								"uuid": schema.StringAttribute{
									Computed: true,
								},
							},
						},
					},
				},
				"config_saved": schema.BoolAttribute{
					Computed: true,
				},
				"custom_precfg": schema.BoolAttribute{
					Computed: true,
				},
				"description": schema.StringAttribute{
					Computed: true,
				},
				"gid": schema.Int64Attribute{
					Computed: true,
				},
				"guid": schema.Int64Attribute{
					Computed: true,
				},
				"id": schema.Int64Attribute{
					Computed: true,
				},
				"interfaces": schema.ListNestedAttribute{
					Computed: true,
					NestedObject: schema.NestedAttributeObject{
						Attributes: map[string]schema.Attribute{
							"conn_id": schema.Int64Attribute{
								Computed: true,
							},
							"conn_type": schema.StringAttribute{
								Computed: true,
							},
							"def_gw": schema.StringAttribute{
								Computed: true,
							},
							"enabled": schema.BoolAttribute{
								Computed: true,
							},
							"flipgroup_id": schema.Int64Attribute{
								Computed: true,
							},
							"guid": schema.StringAttribute{
								Computed: true,
							},
							"ip_address": schema.StringAttribute{
								Computed: true,
							},
							"listen_ssh": schema.BoolAttribute{
								Computed: true,
							},
							"mac": schema.StringAttribute{
								Computed: true,
							},
							"name": schema.StringAttribute{
								Computed: true,
							},
							"net_id": schema.Int64Attribute{
								Computed: true,
							},
							"net_mask": schema.Int64Attribute{
								Computed: true,
							},
							"net_type": schema.StringAttribute{
								Computed: true,
							},
							"node_id": schema.Int64Attribute{
								Computed: true,
							},
							"pci_slot": schema.Int64Attribute{
								Computed: true,
							},
							"qos": schema.SingleNestedAttribute{
								Computed: true,
								Attributes: map[string]schema.Attribute{
									"e_rate": schema.Int64Attribute{
										Computed: true,
									},
									"guid": schema.StringAttribute{
										Computed: true,
									},
									"in_burst": schema.Int64Attribute{
										Computed: true,
									},
									"in_rate": schema.Int64Attribute{
										Computed: true,
									},
								},
							},
							"target": schema.StringAttribute{
								Computed: true,
							},
							"type": schema.StringAttribute{
								Computed: true,
							},
							"vnfs": schema.ListAttribute{
								Computed:    true,
								ElementType: types.Int64Type,
							},
						},
					},
				},
				"lock_status": schema.StringAttribute{
					Computed: true,
				},
				"meta": schema.ListAttribute{
					Computed:    true,
					ElementType: types.StringType,
				},
				"milestones": schema.Int64Attribute{
					Computed: true,
				},
				"name": schema.StringAttribute{
					Computed: true,
				},
				"status": schema.StringAttribute{
					Computed: true,
				},
				"tech_status": schema.StringAttribute{
					Computed: true,
				},
				"type": schema.StringAttribute{
					Computed: true,
				},
				"vnc_password": schema.StringAttribute{
					Computed: true,
				},
				"vins": schema.ListAttribute{
					Computed:    true,
					ElementType: types.Int64Type,
				},
			},
		},
		"account_id": schema.Int64Attribute{
			Computed: true,
		},
		"account_name": schema.StringAttribute{
			Computed: true,
		},
		"created_by": schema.StringAttribute{
			Computed: true,
		},
		"created_time": schema.Int64Attribute{
			Computed: true,
		},
		"default_gw": schema.StringAttribute{
			Computed: true,
		},
		"default_qos": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"e_rate": schema.Int64Attribute{
					Computed: true,
				},
				"guid": schema.StringAttribute{
					Computed: true,
				},
				"in_burst": schema.Int64Attribute{
					Computed: true,
				},
				"in_rate": schema.Int64Attribute{
					Computed: true,
				},
			},
		},
		"deleted_by": schema.StringAttribute{
			Computed: true,
		},
		"deleted_time": schema.Int64Attribute{
			Computed: true,
		},
		"description": schema.StringAttribute{
			Computed: true,
		},
		"gid": schema.Int64Attribute{
			Computed: true,
		},
		"guid": schema.Int64Attribute{
			Computed: true,
		},
		"lock_status": schema.StringAttribute{
			Computed: true,
		},
		"manager_id": schema.Int64Attribute{
			Computed: true,
		},
		"manager_type": schema.StringAttribute{
			Computed: true,
		},
		"milestones": schema.Int64Attribute{
			Computed: true,
		},
		"name": schema.StringAttribute{
			Computed: true,
		},
		"netmask": schema.Int64Attribute{
			Computed: true,
		},
		"network": schema.StringAttribute{
			Computed: true,
		},
		"pre_reservations_num": schema.Int64Attribute{
			Computed: true,
		},
		"redundant": schema.BoolAttribute{
			Computed: true,
		},
		"rg_id": schema.Int64Attribute{
			Computed: true,
		},
		"rg_name": schema.StringAttribute{
			Computed: true,
		},
		"sec_vnf_dev_id": schema.Int64Attribute{
			Computed: true,
		},
		"status": schema.StringAttribute{
			Computed: true,
		},
		"updated_by": schema.StringAttribute{
			Computed: true,
		},
		"updated_time": schema.Int64Attribute{
			Computed: true,
		},
		"user_managed": schema.BoolAttribute{
			Computed: true,
		},
		"vnfs": schema.SingleNestedAttribute{
			Computed: true,
			Attributes: map[string]schema.Attribute{
				"dhcp": schema.SingleNestedAttribute{
					Computed: true,
					Attributes: map[string]schema.Attribute{
						"ckey": schema.StringAttribute{
							Computed: true,
						},
						"account_id": schema.Int64Attribute{
							Computed: true,
						},
						"config": schema.SingleNestedAttribute{
							Computed: true,
							Attributes: map[string]schema.Attribute{
								"default_gw": schema.StringAttribute{
									Computed: true,
								},
								"dns": schema.ListAttribute{
									Computed:    true,
									ElementType: types.StringType,
								},
								"ip_end": schema.StringAttribute{
									Computed: true,
								},
								"ip_start": schema.StringAttribute{
									Computed: true,
								},
								"lease": schema.Int64Attribute{
									Computed: true,
								},
								"netmask": schema.Int64Attribute{
									Computed: true,
								},
								"network": schema.StringAttribute{
									Computed: true,
								},
								"reservations": schema.ListNestedAttribute{
									Computed: true,
									NestedObject: schema.NestedAttributeObject{
										Attributes: map[string]schema.Attribute{
											"account_id": schema.Int64Attribute{
												Computed: true,
											},
											"ip": schema.StringAttribute{
												Computed: true,
											},
											"mac": schema.StringAttribute{
												Computed: true,
											},
											"type": schema.StringAttribute{
												Computed: true,
											},
											"vm_id": schema.Int64Attribute{
												Computed: true,
											},
										},
									},
								},
							},
						},
						"created_time": schema.Int64Attribute{
							Computed: true,
						},
						"devices": schema.SingleNestedAttribute{
							Computed: true,
							Attributes: map[string]schema.Attribute{
								"primary": schema.SingleNestedAttribute{
									Computed: true,
									Attributes: map[string]schema.Attribute{
										"dev_id": schema.Int64Attribute{
											Computed: true,
										},
										"iface01": schema.StringAttribute{
											Computed: true,
										},
										"iface02": schema.StringAttribute{
											Computed: true,
										},
									},
								},
							},
						},
						"gid": schema.Int64Attribute{
							Computed: true,
						},
						"guid": schema.Int64Attribute{
							Computed: true,
						},
						"dhcp_id": schema.Int64Attribute{
							Computed: true,
						},
						"lock_status": schema.StringAttribute{
							Computed: true,
						},
						"milestones": schema.Int64Attribute{
							Computed: true,
						},
						"owner_id": schema.Int64Attribute{
							Computed: true,
						},
						"owner_type": schema.StringAttribute{
							Computed: true,
						},
						"pure_virtual": schema.BoolAttribute{
							Computed: true,
						},
						"routes": schema.ListNestedAttribute{
							Computed: true,
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"route_id": schema.Int64Attribute{
										Computed: true,
									},
									"compute_ids": schema.ListAttribute{
										Computed:    true,
										ElementType: types.Int64Type,
									},
									"destination": schema.StringAttribute{
										Computed: true,
									},
									"gateway": schema.StringAttribute{
										Computed: true,
									},
									"guid": schema.StringAttribute{
										Computed: true,
									},
									"netmask": schema.StringAttribute{
										Computed: true,
									},
								},
							},
						},
						"status": schema.StringAttribute{
							Computed: true,
						},
						"tech_status": schema.StringAttribute{
							Computed: true,
						},
						"type": schema.StringAttribute{
							Computed: true,
						},
					},
				},
				"gw": schema.SingleNestedAttribute{
					Computed: true,
					Attributes: map[string]schema.Attribute{
						"ckey": schema.StringAttribute{
							Computed: true,
						},
						"account_id": schema.Int64Attribute{
							Computed: true,
						},
						"config": schema.SingleNestedAttribute{
							Computed: true,
							Attributes: map[string]schema.Attribute{
								"default_gw": schema.StringAttribute{
									Computed: true,
								},
								"ext_net_id": schema.Int64Attribute{
									Computed: true,
								},
								"ext_net_ip": schema.StringAttribute{
									Computed: true,
								},
								"ext_netmask": schema.Int64Attribute{
									Computed: true,
								},
								"qos": schema.SingleNestedAttribute{
									Computed: true,
									Attributes: map[string]schema.Attribute{
										"e_rate": schema.Int64Attribute{
											Computed: true,
										},
										"guid": schema.StringAttribute{
											Computed: true,
										},
										"in_burst": schema.Int64Attribute{
											Computed: true,
										},
										"in_rate": schema.Int64Attribute{
											Computed: true,
										},
									},
								},
							},
						},
						"created_time": schema.Int64Attribute{
							Computed: true,
						},
						"devices": schema.SingleNestedAttribute{
							Computed: true,
							Attributes: map[string]schema.Attribute{
								"primary": schema.SingleNestedAttribute{
									Computed: true,
									Attributes: map[string]schema.Attribute{
										"dev_id": schema.Int64Attribute{
											Computed: true,
										},
										"iface01": schema.StringAttribute{
											Computed: true,
										},
										"iface02": schema.StringAttribute{
											Computed: true,
										},
									},
								},
							},
						},
						"gid": schema.Int64Attribute{
							Computed: true,
						},
						"guid": schema.Int64Attribute{
							Computed: true,
						},
						"gw_id": schema.Int64Attribute{
							Computed: true,
						},
						"lock_status": schema.StringAttribute{
							Computed: true,
						},
						"milestones": schema.Int64Attribute{
							Computed: true,
						},
						"owner_id": schema.Int64Attribute{
							Computed: true,
						},
						"owner_type": schema.StringAttribute{
							Computed: true,
						},
						"pure_virtual": schema.BoolAttribute{
							Computed: true,
						},
						"routes": schema.ListNestedAttribute{
							Computed: true,
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"compute_ids": schema.ListAttribute{
										Computed:    true,
										ElementType: types.Int64Type,
									},
									"route_id": schema.Int64Attribute{
										Computed: true,
									},
									"guid": schema.StringAttribute{
										Computed: true,
									},
									"destination": schema.StringAttribute{
										Computed: true,
									},
									"netmask": schema.StringAttribute{
										Computed: true,
									},
									"gateway": schema.StringAttribute{
										Computed: true,
									},
								},
							},
						},
						"status": schema.StringAttribute{
							Computed: true,
						},
						"tech_status": schema.StringAttribute{
							Computed: true,
						},
						"type": schema.StringAttribute{
							Computed: true,
						},
					},
				},
				"nat": schema.SingleNestedAttribute{
					Computed: true,
					Attributes: map[string]schema.Attribute{
						"ckey": schema.StringAttribute{
							Computed: true,
						},
						"account_id": schema.Int64Attribute{
							Computed: true,
						},
						"config": schema.SingleNestedAttribute{
							Computed: true,
							Attributes: map[string]schema.Attribute{
								"net_mask": schema.Int64Attribute{
									Computed: true,
								},
								"network": schema.StringAttribute{
									Computed: true,
								},
								"rules": schema.ListNestedAttribute{
									Computed: true,
									NestedObject: schema.NestedAttributeObject{
										Attributes: map[string]schema.Attribute{
											"rule_id": schema.Int64Attribute{
												Computed: true,
											},
											"local_ip": schema.StringAttribute{
												Computed: true,
											},
											"local_port": schema.Int64Attribute{
												Computed: true,
											},
											"protocol": schema.StringAttribute{
												Computed: true,
											},
											"public_port_end": schema.Int64Attribute{
												Computed: true,
											},
											"public_port_start": schema.Int64Attribute{
												Computed: true,
											},
											"vm_id": schema.Int64Attribute{
												Computed: true,
											},
											"vm_name": schema.StringAttribute{
												Computed: true,
											},
										},
									},
								},
							},
						},
						"created_time": schema.Int64Attribute{
							Computed: true,
						},
						"devices": schema.SingleNestedAttribute{
							Computed: true,
							Attributes: map[string]schema.Attribute{
								"primary": schema.SingleNestedAttribute{
									Computed: true,
									Attributes: map[string]schema.Attribute{
										"dev_id": schema.Int64Attribute{
											Computed: true,
										},
										"iface01": schema.StringAttribute{
											Computed: true,
										},
										"iface02": schema.StringAttribute{
											Computed: true,
										},
									},
								},
							},
						},
						"gid": schema.Int64Attribute{
							Computed: true,
						},
						"guid": schema.Int64Attribute{
							Computed: true,
						},
						"nat_id": schema.Int64Attribute{
							Computed: true,
						},
						"lock_status": schema.StringAttribute{
							Computed: true,
						},
						"milestones": schema.Int64Attribute{
							Computed: true,
						},
						"owner_id": schema.Int64Attribute{
							Computed: true,
						},
						"owner_type": schema.StringAttribute{
							Computed: true,
						},
						"pure_virtual": schema.BoolAttribute{
							Computed: true,
						},
						"routes": schema.ListNestedAttribute{
							Computed: true,
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"compute_ids": schema.ListAttribute{
										Computed:    true,
										ElementType: types.Int64Type,
									},
									"route_id": schema.Int64Attribute{
										Computed: true,
									},
									"guid": schema.StringAttribute{
										Computed: true,
									},
									"destination": schema.StringAttribute{
										Computed: true,
									},
									"netmask": schema.StringAttribute{
										Computed: true,
									},
									"gateway": schema.StringAttribute{
										Computed: true,
									},
								},
							},
						},
						"status": schema.StringAttribute{
							Computed: true,
						},
						"tech_status": schema.StringAttribute{
							Computed: true,
						},
						"type": schema.StringAttribute{
							Computed: true,
						},
					},
				},
			},
		},
		"vxlan_id": schema.Int64Attribute{
			Computed: true,
		},
	}
}
