{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://morphir.finos.org/schemas/extensions/0.1.0-preview.3/index-record.schema.json",
  "title": "Extension repository history record",
  "type": "object",
  "required": [ "$schema", "id", "name", "version", "channels", "artifacts" ],
  "properties": {
    "$schema": {
      "const": "https://morphir.finos.org/schemas/extensions/0.1.0-preview.3/index-record.schema.json"
    },
    "id": {
      "type": "string",
      "not": {
        "pattern": "^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\\.|$)"
      },
      "pattern": "^[a-z]([a-z0-9-]*[a-z0-9])?(\\.[a-z]([a-z0-9-]*[a-z0-9])?)*$",
      "maxLength": 238
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "version": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"
    },
    "channels": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "mepVersions": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"
      }
    },
    "capabilities": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "enum": [ "frontend", "backend", "transform", "validator", "workspace" ]
      }
    },
    "frontend": {
      "type": "object",
      "required": [ "languages", "irVersions", "compile" ],
      "properties": {
        "languages": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [ "id", "fileExtensions" ],
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "fileExtensions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": true
          }
        },
        "irVersions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "compile": {
          "type": "boolean"
        },
        "incremental": {
          "type": "boolean"
        },
        "fragments": {
          "type": "boolean"
        },
        "multiDocument": {
          "type": "boolean"
        }
      },
      "additionalProperties": true
    },
    "backend": {
      "type": "object",
      "required": [ "targets", "irVersions", "generate" ],
      "properties": {
        "targets": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "irVersions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "generate": {
          "type": "boolean"
        }
      },
      "additionalProperties": true
    },
    "artifacts": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "https://morphir.finos.org/schemas/extensions/0.1.0-preview.3/release.schema.json#/$defs/indexArtifact"
      }
    },
    "critical": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "requires": {
      "type": "object",
      "required": [ "host" ],
      "properties": {
        "host": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
