{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/gmi-cloud/json-schema/gmi-cloud-image-resp-schema.json",
  "title": "ImageResp",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gmi-cloud-images-api-openapi.yml#/components/schemas/ImageResp",
  "allOf": [
    {
      "$ref": "#/$defs/ImageCreateReq"
    },
    {
      "properties": {
        "createdAt": {
          "format": "date-time",
          "type": "string"
        },
        "id": {
          "format": "uuid",
          "type": "string"
        },
        "type": {
          "enum": [
            "Public",
            "Customized"
          ],
          "type": "string",
          "x-enumNames": [
            "ImageTypePublic",
            "ImageTypeCustomized"
          ]
        }
      },
      "required": [
        "id",
        "type",
        "createdAt"
      ],
      "type": "object"
    }
  ],
  "$defs": {
    "ImageBootMode": {
      "enum": [
        "UEFI",
        "Legacy"
      ],
      "type": "string"
    },
    "ImageConfig": {
      "properties": {
        "supportedProducts": {
          "items": {
            "$ref": "#/$defs/productName"
          },
          "type": "array",
          "x-go-type": "pq.StringArray",
          "x-go-type-import": {
            "path": "github.com/lib/pq"
          }
        }
      },
      "required": [
        "supportedProducts"
      ],
      "type": "object"
    },
    "ImageCreateReq": {
      "allOf": [
        {
          "$ref": "#/$defs/ImageConfig"
        },
        {
          "properties": {
            "BootMode": {
              "$ref": "#/$defs/ImageBootMode"
            },
            "DefaultPartitionTable": {
              "items": {
                "$ref": "#/$defs/partition"
              },
              "minItems": 1,
              "type": "array",
              "x-go-type": "json.RawMessage"
            },
            "OSArchitecture": {
              "type": "string"
            },
            "OSSeries": {
              "type": "string"
            },
            "OSVersion": {
              "type": "string"
            },
            "SystemDiskSize": {
              "type": "string"
            },
            "icon": {
              "format": "uri",
              "type": "string"
            },
            "idc": {
              "$ref": "#/$defs/idcName"
            },
            "name": {
              "$ref": "#/$defs/name"
            },
            "orgId": {
              "format": "uuid",
              "type": "string"
            },
            "path": {
              "type": "string"
            }
          },
          "required": [
            "idc",
            "orgId",
            "path",
            "name",
            "OSSeries",
            "OSVersion",
            "OSArchitecture",
            "BootMode",
            "SystemDiskSize",
            "DefaultPartitionTable",
            "icon"
          ],
          "type": "object"
        }
      ]
    },
    "idcName": {
      "maxLength": 50,
      "pattern": "^[a-zA-Z0-9._-]+$",
      "type": "string"
    },
    "name": {
      "maxLength": 255,
      "pattern": "^([A-Za-z0-9][A-Za-z0-9_\\-. ]*)?[A-Za-z0-9]$",
      "type": "string"
    },
    "partition": {
      "properties": {
        "fileSystem": {
          "maxLength": 256,
          "minLength": 1,
          "type": "string"
        },
        "mountPoint": {
          "maxLength": 1024,
          "minLength": 1,
          "type": "string"
        },
        "name": {
          "$ref": "#/$defs/name"
        },
        "size": {
          "maxLength": 256,
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "name",
        "mountPoint",
        "size",
        "fileSystem"
      ],
      "type": "object"
    },
    "productName": {
      "maxLength": 256,
      "pattern": "^[a-zA-Z0-9._-]+$",
      "type": "string"
    }
  }
}