{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/omdsh-dev/dsh-hub-workshop/blob/main/recipes.schema.json",
  "title": "OMDSH Workshop Configuration Recipes Source",
  "type": "object",
  "required": ["schema", "updatedAt", "recipes"],
  "additionalProperties": false,
  "properties": {
    "$schema": { "type": "string" },
    "schema": { "const": "omdsh-workshop-recipes-source/v1" },
    "updatedAt": { "type": "string", "format": "date-time" },
    "recipes": {
      "type": "array",
      "items": { "$ref": "#/$defs/recipe" }
    }
  },
  "$defs": {
    "localizedText": {
      "type": "object",
      "required": ["title", "summary"],
      "additionalProperties": false,
      "properties": {
        "title": { "type": "string", "minLength": 1 },
        "summary": { "type": "string", "minLength": 12 }
      }
    },
    "taskIntent": {
      "type": "object",
      "required": ["id", "title", "translations"],
      "additionalProperties": false,
      "properties": {
        "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
        "title": { "type": "string", "minLength": 1 },
        "translations": {
          "type": "object",
          "required": ["en"],
          "additionalProperties": false,
          "properties": { "en": { "type": "string", "minLength": 1 } }
        }
      }
    },
    "recipe": {
      "type": "object",
      "required": ["id", "kind", "title", "summary", "translations", "author", "source", "compatibility", "featured", "items"],
      "additionalProperties": false,
      "properties": {
        "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
        "kind": { "enum": ["configuration", "distribution"] },
        "title": { "type": "string", "minLength": 1 },
        "summary": { "type": "string", "minLength": 12 },
        "translations": {
          "type": "object",
          "required": ["en"],
          "additionalProperties": false,
          "properties": {
            "en": { "$ref": "#/$defs/localizedText" }
          }
        },
        "useCases": {
          "type": "array",
          "minItems": 1,
          "maxItems": 5,
          "items": { "$ref": "#/$defs/taskIntent" }
        },
        "author": {
          "type": "object",
          "required": ["name", "url"],
          "additionalProperties": false,
          "properties": {
            "name": { "type": "string", "minLength": 1 },
            "url": { "type": "string", "format": "uri" }
          }
        },
        "source": {
          "type": "object",
          "required": ["repository", "ref"],
          "additionalProperties": false,
          "properties": {
            "repository": { "type": "string", "format": "uri", "pattern": "^https://github\\.com/" },
            "ref": { "type": "string", "pattern": "^[0-9a-f]{40}$" }
          }
        },
        "compatibility": {
          "type": "object",
          "required": ["harness", "declared"],
          "additionalProperties": false,
          "properties": {
            "harness": { "type": "string", "minLength": 1 },
            "declared": { "type": "string", "minLength": 1 }
          }
        },
        "featured": { "type": "boolean" },
        "items": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": ["projectId", "releaseId", "enabled"],
            "additionalProperties": false,
            "properties": {
              "projectId": { "type": "string", "minLength": 1 },
              "releaseId": { "type": "string", "minLength": 1 },
              "enabled": { "type": "boolean" }
            }
          }
        }
      }
    }
  }
}
