{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://fleet.forgesdlc.com/schemas/container-types.schema.json",
  "title": "Forge Fleet container types catalog",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "categories", "types"],
  "properties": {
    "version": { "type": "integer", "minimum": 1 },
    "categories": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/category" }
    },
    "types": {
      "type": "array",
      "items": { "$ref": "#/$defs/typeRow" }
    }
  },
  "$defs": {
    "capabilities": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "admin_spawnable": { "type": "boolean" },
        "api_manage_services": { "type": "boolean" },
        "allow_docker_argv_jobs": { "type": "boolean" }
      }
    },
    "category": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "title"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "title": { "type": "string", "minLength": 1, "maxLength": 200 },
        "description": { "type": "string", "maxLength": 4000 },
        "capabilities": { "$ref": "#/$defs/capabilities" }
      }
    },
    "typeRow": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "category_id", "container_class", "title"],
      "properties": {
        "id": { "type": "string", "pattern": "^[a-z][a-z0-9_-]{0,63}$" },
        "category_id": { "type": "string", "minLength": 1 },
        "container_class": { "type": "string", "pattern": "^[a-z][a-z0-9_-]{0,127}$" },
        "title": { "type": "string", "minLength": 1, "maxLength": 200 },
        "notes": { "type": "string", "maxLength": 8000 },
        "requirements": {
          "type": "array",
          "items": { "type": "string", "pattern": "^[a-z][a-z0-9_-]{0,63}$" }
        },
        "admin_spawnable": { "type": "boolean" },
        "api_manage_services": { "type": "boolean" },
        "allow_docker_argv_jobs": { "type": "boolean" }
      }
    }
  }
}
