package image

import (
	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
	"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
	"repository.basistech.ru/BASIS/terraform-provider-decort/internal/statefuncs"
)

func resourceCDROMImageV1() *schema.Resource {
	return &schema.Resource{
		Schema: map[string]*schema.Schema{
			"name": {
				Type:        schema.TypeString,
				Required:    true,
				Description: "Name of the rescue disk",
			},
			"url": {
				Type:        schema.TypeString,
				Required:    true,
				Description: "URL where to download ISO from",
			},
			"gid": {
				Type:        schema.TypeInt,
				Required:    true,
				Description: "grid (platform) ID where this template should be create in",
			},
			"drivers": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Schema{
					Type: schema.TypeString,
				},
				Description: "List of types of compute suitable for image. Example: [ \"KVM_X86\" ]",
			},
			"hot_resize": {
				Type:        schema.TypeBool,
				Optional:    true,
				Computed:    true,
				Description: "Does this machine supports hot resize",
			},
			"account_id": {
				Type:        schema.TypeInt,
				Optional:    true,
				Computed:    true,
				Description: "AccountId to make the image exclusive",
			},
			"username_dl": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "username for upload binary media",
			},
			"password_dl": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "password for upload binary media",
			},
			"sep_id": {
				Type:        schema.TypeInt,
				Optional:    true,
				Computed:    true,
				Description: "storage endpoint provider ID",
			},
			"pool_name": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "pool for image create",
			},
			"architecture": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "binary architecture of this image, one of X86_64",
			},
			"bootable": {
				Type:        schema.TypeBool,
				Optional:    true,
				Computed:    true,
				Description: "Does this image boot OS",
			},
			"enabled": {
				Type:     schema.TypeBool,
				Optional: true,
				Computed: true,
			},
			"computeci_id": {
				Type:     schema.TypeInt,
				Optional: true,
				Computed: true,
			},
			"shared_with": {
				Type:     schema.TypeList,
				Optional: true,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"enabled_stacks": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"unc_path": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "unc path",
			},
			"ckey": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"meta": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeString,
				},
				Description: "meta",
			},
			"acl": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"explicit": {
							Type:     schema.TypeBool,
							Computed: true,
						},
						"guid": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"right": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"status": {
							Type:     schema.TypeString,
							Computed: true},
						"type": {
							Type:     schema.TypeString,
							Computed: true},
						"user_group_id": {
							Type:     schema.TypeString,
							Computed: true,
						},
					},
				},
			},
			"boot_type": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "Boot type of image bios or uefi",
			},
			"guid": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"image_id": {
				Type:        schema.TypeInt,
				Computed:    true,
				Description: "image id",
			},
			"image_type": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "Image type linux, windows or other",
			},
			"link_to": {
				Type:        schema.TypeInt,
				Computed:    true,
				Description: "",
			},
			"milestones": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"provider_name": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"purge_attempts": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"reference_id": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"res_id": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"res_name": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"rescuecd": {
				Type:     schema.TypeBool,
				Computed: true,
			},
			"last_modified": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"desc": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"deleted_time": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"present_to": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"snapshot_id": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "snapshot id",
			},
			"status": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "status",
			},
			"tech_status": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "tech atatus",
			},
			"version": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "version",
			},
			"size": {
				Type:        schema.TypeInt,
				Computed:    true,
				Description: "image size",
			},
			"history": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"guid": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"id": {
							Type:     schema.TypeInt,
							Computed: true,
						},
						"timestamp": {
							Type:     schema.TypeInt,
							Computed: true,
						},
					},
				},
			},
		},
	}
}

func resourceImageV1() *schema.Resource {
	return &schema.Resource{
		Schema: map[string]*schema.Schema{
			"name": {
				Type:        schema.TypeString,
				Required:    true,
				Description: "Name of the rescue disk",
			},
			"url": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "URL where to download media from",
			},
			"file_path": {
				Type:        schema.TypeString,
				Optional:    true,
				Description: "path to image file",
			},
			"gid": {
				Type:        schema.TypeInt,
				Required:    true,
				Description: "grid (platform) ID where this template should be create in",
			},
			"boot_type": {
				Type:        schema.TypeString,
				Required:    true,
				Description: "Boot type of image bios or uefi",
			},
			"image_type": {
				Type:        schema.TypeString,
				Required:    true,
				Description: "Image type linux, windows or other",
			},
			"drivers": {
				Type:     schema.TypeList,
				Optional: true,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeString,
				},
				Description: "List of types of compute suitable for image. Example: [ \"KVM_X86\" ]",
			},
			"hot_resize": {
				Type:        schema.TypeBool,
				Optional:    true,
				Computed:    true,
				Description: "Does this machine supports hot resize",
			},
			"network_interface_naming": {
				Type:         schema.TypeString,
				Optional:     true,
				Computed:     true,
				ValidateFunc: validation.StringInSlice([]string{"eth", "ens"}, true),
				Description:  "select a network interface naming pattern for your Linux machine. eth - onboard, ens - pci slot naming",
			},
			"username": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "Optional username for the image",
			},
			"password": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "Optional password for the image",
			},
			"account_id": {
				Type:        schema.TypeInt,
				Optional:    true,
				Computed:    true,
				Description: "AccountId to make the image exclusive",
			},
			"username_dl": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "username for upload binary media",
			},
			"password_dl": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "password for upload binary media",
			},
			"sep_id": {
				Type:        schema.TypeInt,
				Optional:    true,
				Computed:    true,
				Description: "storage endpoint provider ID",
			},
			"pool_name": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "pool for image create",
			},
			"architecture": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "binary architecture of this image, one of X86_64",
			},
			"bootable": {
				Type:        schema.TypeBool,
				Optional:    true,
				Computed:    true,
				Description: "Does this image boot OS",
			},
			"enabled": {
				Type:     schema.TypeBool,
				Optional: true,
				Computed: true,
			},
			"computeci_id": {
				Type:     schema.TypeInt,
				Optional: true,
				Computed: true,
			},
			"sync_mode": {
				Type:        schema.TypeBool,
				Optional:    true,
				Default:     false,
				Description: "Create image from a media identified by URL (in synchronous mode)",
			},
			"enabled_stacks": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"shared_with": {
				Type:     schema.TypeList,
				Optional: true,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},

			"accounts": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"unc_path": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "unc path",
			},
			"acl": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"explicit": {
							Type:     schema.TypeBool,
							Computed: true,
						},
						"guid": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"right": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"status": {
							Type:     schema.TypeString,
							Computed: true},
						"type": {
							Type:     schema.TypeString,
							Computed: true},
						"user_group_id": {
							Type:     schema.TypeString,
							Computed: true,
						},
					},
				},
			},
			"guid": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"cd_presented_to": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"image_id": {
				Type:        schema.TypeInt,
				Computed:    true,
				Description: "image id",
			},
			"link_to": {
				Type:        schema.TypeInt,
				Computed:    true,
				Description: "",
			},
			"milestones": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"provider_name": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"purge_attempts": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"reference_id": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"res_id": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"res_name": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"rescuecd": {
				Type:     schema.TypeBool,
				Computed: true,
			},
			"last_modified": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"deleted_time": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"desc": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"present_to": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"snapshot_id": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "snapshot id",
			},
			"status": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "status",
			},
			"tech_status": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "tech atatus",
			},
			"version": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "version",
			},
			"size": {
				Type:        schema.TypeInt,
				Computed:    true,
				Description: "image size",
			},
			"history": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"guid": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"id": {
							Type:     schema.TypeInt,
							Computed: true,
						},
						"timestamp": {
							Type:     schema.TypeInt,
							Computed: true,
						},
					},
				},
			},
		},
	}
}

func resourceVirtualImageV1() *schema.Resource {
	return &schema.Resource{
		Schema: map[string]*schema.Schema{
			"link_to": {
				Type:        schema.TypeInt,
				Required:    true,
				Description: "ID of real image to link this virtual image to upon creation",
			},
			"name": {
				Type:        schema.TypeString,
				Required:    true,
				Description: "Name of the rescue disk",
			},
			"account_id": {
				Type:        schema.TypeInt,
				Optional:    true,
				Computed:    true,
				Description: "AccountId to make the image exclusive",
			},
			"bootable": {
				Type:        schema.TypeBool,
				Optional:    true,
				Computed:    true,
				Description: "Does this image boot OS",
			},
			"computeci_id": {
				Type:     schema.TypeInt,
				Optional: true,
				Computed: true,
			},
			"enabled": {
				Type:     schema.TypeBool,
				Optional: true,
				Computed: true,
			},
			"hot_resize": {
				Type:        schema.TypeBool,
				Optional:    true,
				Computed:    true,
				Description: "Does this machine supports hot resize",
			},
			"password": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "Optional password for the image",
			},
			"username": {
				Type:        schema.TypeString,
				Computed:    true,
				Optional:    true,
				Description: "Optional username for the image",
			},
			"shared_with": {
				Type:     schema.TypeList,
				Optional: true,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"enabled_stacks": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},

			"unc_path": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "unc path",
			},
			"ckey": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"meta": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeString,
				},
				Description: "meta",
			},
			"acl": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"explicit": {
							Type:     schema.TypeBool,
							Computed: true,
						},
						"guid": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"right": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"status": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"type": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"user_group_id": {
							Type:     schema.TypeString,
							Computed: true,
						},
					},
				},
			},
			"architecture": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "binary architecture of this image, one of X86_64",
			},
			"boot_type": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "Boot type of image bios or uefi",
			},
			"deleted_time": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"desc": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"drivers": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeString,
				},
				Description: "List of types of compute suitable for image. Example: [ \"KVM_X86\" ]",
			},
			"gid": {
				Type:        schema.TypeInt,
				Computed:    true,
				Description: "grid (platform) ID where this template should be create in",
			},
			"guid": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"history": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"guid": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"id": {
							Type:     schema.TypeInt,
							Computed: true,
						},
						"timestamp": {
							Type:     schema.TypeInt,
							Computed: true,
						},
					},
				},
			},
			"image_id": {
				Type:        schema.TypeInt,
				Computed:    true,
				Description: "Image id",
			},
			"last_modified": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"milestones": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"pool_name": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "pool for image create",
			},
			"present_to": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"provider_name": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"purge_attempts": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"reference_id": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"res_id": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"res_name": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"rescuecd": {
				Type:     schema.TypeBool,
				Computed: true,
			},
			"sep_id": {
				Type:        schema.TypeInt,
				Computed:    true,
				Description: "storage endpoint provider ID",
			},
			"size": {
				Type:        schema.TypeInt,
				Computed:    true,
				Description: "image size",
			},
			"snapshot_id": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "snapshot id",
			},
			"status": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "status",
			},
			"tech_status": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "tech atatus",
			},
			"image_type": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "Image type linux, windows or other",
			},
			"url": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "URL where to download media from",
			},
			"version": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "version",
			},
		},
	}
}

func resourceImageFromBlankComputeV1() *schema.Resource {
	return &schema.Resource{
		Schema: map[string]*schema.Schema{
			"compute_id": {
				Type:        schema.TypeInt,
				Required:    true,
				Description: "Compute Id",
			},
			"name": {
				Type:        schema.TypeString,
				Required:    true,
				Description: "Name of the rescue disk",
			},
			"boot_type": {
				Type:         schema.TypeString,
				Required:     true,
				ValidateFunc: validation.StringInSlice([]string{"bios", "uefi"}, true),
				Description:  "Boot type of image BIOS or UEFI",
			},
			"image_type": {
				Type:         schema.TypeString,
				Required:     true,
				ValidateFunc: validation.StringInSlice([]string{"linux", "windows", "other"}, true),
				Description:  "Image type linux, windows or other",
			},

			"username": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "Optional username for the image",
			},
			"password": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "Optional password for the image",
			},
			"account_id": {
				Type:        schema.TypeInt,
				Optional:    true,
				Computed:    true,
				Description: "AccountId to make the image exclusive",
			},
			"sep_id": {
				Type:        schema.TypeInt,
				Optional:    true,
				Computed:    true,
				Description: "storage endpoint provider ID",
			},
			"pool_name": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "pool for image create",
			},
			"hot_resize": {
				Type:        schema.TypeBool,
				Optional:    true,
				Computed:    true,
				Description: "Does this machine supports hot resize",
			},
			"async_mode": {
				Type:        schema.TypeBool,
				Optional:    true,
				Default:     false,
				Description: "create an image in async/sync mode",
			},
			"bootable": {
				Type:        schema.TypeBool,
				Optional:    true,
				Computed:    true,
				Description: "Does this image boot OS",
			},
			"enabled": {
				Type:     schema.TypeBool,
				Optional: true,
				Computed: true,
			},
			"computeci_id": {
				Type:     schema.TypeInt,
				Optional: true,
				Computed: true,
			},
			"enabled_stacks": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"shared_with": {
				Type:     schema.TypeList,
				Optional: true,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},

			"accounts": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"network_interface_naming": {
				Type:         schema.TypeString,
				Optional:     true,
				Computed:     true,
				ValidateFunc: validation.StringInSlice([]string{"eth", "ens"}, true),
				Description:  "select a network interface naming pattern for your Linux machine. eth - onboard, ens - pci slot naming",
			},

			"image_id": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"unc_path": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"acl": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"explicit": {
							Type:     schema.TypeBool,
							Computed: true,
						},
						"guid": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"right": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"status": {
							Type:     schema.TypeString,
							Computed: true},
						"type": {
							Type:     schema.TypeString,
							Computed: true},
						"user_group_id": {
							Type:     schema.TypeString,
							Computed: true,
						},
					},
				},
			},
			"architecture": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"cd_presented_to": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"deleted_time": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"desc": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"drivers": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeString,
				},
			},
			"gid": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"guid": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"history": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"guid": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"id": {
							Type:     schema.TypeInt,
							Computed: true,
						},
						"timestamp": {
							Type:     schema.TypeInt,
							Computed: true,
						},
					},
				},
			},
			"last_modified": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"link_to": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"milestones": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"provider_name": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"purge_attempts": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"present_to": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"reference_id": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"res_id": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"res_name": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"rescuecd": {
				Type:     schema.TypeBool,
				Computed: true,
			},
			"size": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"snapshot_id": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "snapshot id",
			},
			"status": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"tech_status": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"url": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"version": {
				Type:     schema.TypeString,
				Computed: true,
			},
		},
	}
}

func resourceImageFromPlatformDiskV1() *schema.Resource {
	return &schema.Resource{
		Schema: map[string]*schema.Schema{
			"disk_id": {
				Type:        schema.TypeInt,
				Required:    true,
				Description: "Disk Id",
			},
			"name": {
				Type:        schema.TypeString,
				Required:    true,
				Description: "Name of the rescue disk",
			},
			"boot_type": {
				Type:         schema.TypeString,
				Required:     true,
				ValidateFunc: validation.StringInSlice([]string{"bios", "uefi"}, true),
				Description:  "Boot type of image BIOS or UEFI",
			},
			"image_type": {
				Type:         schema.TypeString,
				Required:     true,
				ValidateFunc: validation.StringInSlice([]string{"linux", "windows", "other"}, true),
				Description:  "Image type linux, windows or other",
			},
			"architecture": {
				Type:         schema.TypeString,
				Required:     true,
				ValidateFunc: validation.StringInSlice([]string{"X86_64"}, true),
				Description:  "Image type linux, windows or other",
			},

			"username": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "Optional username for the image",
			},
			"password": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "Optional password for the image",
			},
			"account_id": {
				Type:        schema.TypeInt,
				Optional:    true,
				Computed:    true,
				Description: "AccountId to make the image exclusive",
			},
			"sep_id": {
				Type:        schema.TypeInt,
				Optional:    true,
				Computed:    true,
				Description: "storage endpoint provider ID",
			},
			"drivers": {
				Type:     schema.TypeList,
				Required: true,
				Elem: &schema.Schema{
					StateFunc:    statefuncs.StateFuncToUpper,
					ValidateFunc: validation.StringInSlice([]string{"SVA_KVM_X86", "KVM_X86"}, false), // observe case while validating
					Type:         schema.TypeString,
				},
				Description: "List of types of compute suitable for image. Example: [ \"KVM_X86\" ]",
			},
			"pool_name": {
				Type:        schema.TypeString,
				Optional:    true,
				Computed:    true,
				Description: "pool for image create",
			},
			"hot_resize": {
				Type:        schema.TypeBool,
				Optional:    true,
				Computed:    true,
				Description: "Does this machine supports hot resize",
			},
			"async_mode": {
				Type:        schema.TypeBool,
				Optional:    true,
				Default:     false,
				Description: "create an image in async/sync mode",
			},
			"bootable": {
				Type:        schema.TypeBool,
				Optional:    true,
				Computed:    true,
				Description: "Does this image boot OS",
			},
			"enabled": {
				Type:     schema.TypeBool,
				Optional: true,
				Computed: true,
			},
			"computeci_id": {
				Type:     schema.TypeInt,
				Optional: true,
				Computed: true,
			},
			"enabled_stacks": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"shared_with": {
				Type:     schema.TypeList,
				Optional: true,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},

			"accounts": {
				Type:     schema.TypeList,
				Optional: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"network_interface_naming": {
				Type:         schema.TypeString,
				Optional:     true,
				Computed:     true,
				ValidateFunc: validation.StringInSlice([]string{"eth", "ens"}, true),
				Description:  "select a network interface naming pattern for your Linux machine. eth - onboard, ens - pci slot naming",
			},

			"image_id": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"unc_path": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"acl": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"explicit": {
							Type:     schema.TypeBool,
							Computed: true,
						},
						"guid": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"right": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"status": {
							Type:     schema.TypeString,
							Computed: true},
						"type": {
							Type:     schema.TypeString,
							Computed: true},
						"user_group_id": {
							Type:     schema.TypeString,
							Computed: true,
						},
					},
				},
			},
			"cd_presented_to": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"deleted_time": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"desc": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"gid": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"guid": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"history": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						"guid": {
							Type:     schema.TypeString,
							Computed: true,
						},
						"id": {
							Type:     schema.TypeInt,
							Computed: true,
						},
						"timestamp": {
							Type:     schema.TypeInt,
							Computed: true,
						},
					},
				},
			},
			"last_modified": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"link_to": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"milestones": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"provider_name": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"purge_attempts": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"present_to": {
				Type:     schema.TypeList,
				Computed: true,
				Elem: &schema.Schema{
					Type: schema.TypeInt,
				},
			},
			"reference_id": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"res_id": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"res_name": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"rescuecd": {
				Type:     schema.TypeBool,
				Computed: true,
			},
			"size": {
				Type:     schema.TypeInt,
				Computed: true,
			},
			"snapshot_id": {
				Type:        schema.TypeString,
				Computed:    true,
				Description: "snapshot id",
			},
			"status": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"tech_status": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"url": {
				Type:     schema.TypeString,
				Computed: true,
			},
			"version": {
				Type:     schema.TypeString,
				Computed: true,
			},
		},
	}
}
