package dpdknet

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

func dataSourceDPDKNetSchemaMake() map[string]*schema.Schema {
	res := map[string]*schema.Schema{
		"dpdk_id": {
			Type:        schema.TypeInt,
			Required:    true,
			Description: "The unique ID of the subscriber-owner of the DPDK network",
		},
		"account_access": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Schema{
				Type: schema.TypeInt,
			},
			Description: "List of accounts with access",
		},
		"created_time": {
			Type:        schema.TypeInt,
			Computed:    true,
			Description: "Created time",
		},
		"desc": {
			Type:        schema.TypeString,
			Computed:    true,
			Description: "Description of DPDK network",
		},
		"gid": {
			Type:        schema.TypeInt,
			Computed:    true,
			Description: "ID of the grid (platform)",
		},
		"guid": {
			Type:        schema.TypeInt,
			Computed:    true,
			Description: "DPDK network ID on the storage side",
		},
		"name": {
			Type:        schema.TypeString,
			Computed:    true,
			Description: "Name of network",
		},
		"rg_access": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Schema{
				Type: schema.TypeInt,
			},
			Description: "List of resource groups with access",
		},
		"status": {
			Type:        schema.TypeString,
			Computed:    true,
			Description: "DPDK network status",
		},
		"ovs_bridge": {
			Type:        schema.TypeString,
			Computed:    true,
			Description: "OVS bridge in which interfaces for computers created",
		},
		"vlan_id": {
			Type:        schema.TypeInt,
			Computed:    true,
			Description: "vlan ID",
		},
		"compute_ids": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Schema{
				Type: schema.TypeInt,
			},
			Description: "Compute IDs which uses this DPDK network",
		},
		"updated_time": {
			Type:        schema.TypeInt,
			Computed:    true,
			Description: "Updated time",
		},
	}

	return res
}

func dataSourceDPDKNetListSchemaMake() map[string]*schema.Schema {
	res := map[string]*schema.Schema{
		"by_id": {
			Type:        schema.TypeInt,
			Optional:    true,
			Description: "Find by ID",
		},
		"gid": {
			Type:        schema.TypeInt,
			Optional:    true,
			Description: "Find by GID",
		},
		"name": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "Find by name",
		},
		"desc": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "Find by description",
		},
		"status": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "Find by status",
		},
		"compute_ids": {
			Type:     schema.TypeList,
			Optional: true,
			Elem: &schema.Schema{
				Type: schema.TypeInt,
			},
			Description: "Find by compute IDs",
		},
		"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{
					"dpdk_id": {
						Type:        schema.TypeInt,
						Required:    true,
						Description: "The unique ID of the subscriber-owner of the DPDK network",
					},
					"account_access": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeInt,
						},
						Description: "List of accounts with access",
					},
					"created_time": {
						Type:        schema.TypeInt,
						Computed:    true,
						Description: "Created time",
					},
					"desc": {
						Type:        schema.TypeString,
						Computed:    true,
						Description: "Description of DPDK network",
					},
					"enable_secgroups": {
						Type:     schema.TypeBool,
						Computed: true,
					},
					"gid": {
						Type:        schema.TypeInt,
						Computed:    true,
						Description: "ID of the grid (platform)",
					},
					"guid": {
						Type:        schema.TypeInt,
						Computed:    true,
						Description: "DPDK network ID on the storage side",
					},
					"name": {
						Type:        schema.TypeString,
						Computed:    true,
						Description: "Name of network",
					},
					"rg_access": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeInt,
						},
						Description: "List of resource groups with access",
					},
					"status": {
						Type:        schema.TypeString,
						Computed:    true,
						Description: "DPDK network status",
					},
					"ovs_bridge": {
						Type:        schema.TypeString,
						Computed:    true,
						Description: "OVS bridge in which interfaces for computers created",
					},
					"vlan_id": {
						Type:        schema.TypeInt,
						Computed:    true,
						Description: "vlan ID",
					},
					"compute_ids": {
						Type:     schema.TypeList,
						Computed: true,
						Elem: &schema.Schema{
							Type: schema.TypeInt,
						},
						Description: "Compute IDs which uses this DPDK network",
					},
					"updated_time": {
						Type:        schema.TypeInt,
						Computed:    true,
						Description: "Updated time",
					},
				},
			},
		},
		"entry_count": {
			Type:     schema.TypeInt,
			Computed: true,
		},
	}
	return res
}

func resourceDPDKNetSchemaMake() map[string]*schema.Schema {
	res := map[string]*schema.Schema{
		"gid": {
			Type:        schema.TypeInt,
			Required:    true,
			Description: "ID of the grid (platform)",
		},
		"name": {
			Type:        schema.TypeString,
			Required:    true,
			Description: "Name of network",
		},
		"ovs_bridge": {
			Type:        schema.TypeString,
			Required:    true,
			Description: "OVS bridge in which interfaces for computers created",
		},
		"vlan_id": {
			Type:        schema.TypeInt,
			Required:    true,
			Description: "vlan ID",
		},
		"dpdk_id": {
			Type:        schema.TypeInt,
			Computed:    true,
			Description: "The unique ID of the subscriber-owner of the DPDK network",
		},
		"account_access": {
			Type:     schema.TypeList,
			Optional: true,
			Computed: true,
			Elem: &schema.Schema{
				Type: schema.TypeInt,
			},
			Description: "List of accounts with access",
		},
		"created_time": {
			Type:        schema.TypeInt,
			Computed:    true,
			Description: "Created time",
		},
		"desc": {
			Type:        schema.TypeString,
			Optional:    true,
			Computed:    true,
			Description: "Description of DPDK network",
		},
		"enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Enabled or disabled DPDK network",
		},
		"enable_secgroups": {
			Type:        schema.TypeBool,
			Optional:    true,
			Default:     false,
			Description: "enable security groups",
		},
		"guid": {
			Type:        schema.TypeInt,
			Computed:    true,
			Description: "DPDK network ID on the storage side",
		},
		"rg_access": {
			Type:     schema.TypeList,
			Optional: true,
			Computed: true,
			Elem: &schema.Schema{
				Type: schema.TypeInt,
			},
			Description: "List of resource groups with access",
		},
		"status": {
			Type:        schema.TypeString,
			Computed:    true,
			Description: "DPDK network status",
		},
		"compute_ids": {
			Type:     schema.TypeList,
			Computed: true,
			Elem: &schema.Schema{
				Type: schema.TypeInt,
			},
			Description: "Compute IDs which uses this DPDK network",
		},
		"updated_time": {
			Type:        schema.TypeInt,
			Computed:    true,
			Description: "Updated time",
		},
	}
	return res
}
