{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Workflow Platform community submission",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "id",
    "kind",
    "name",
    "description",
    "version",
    "publisher",
    "license",
    "source",
    "documentation",
    "artifact",
    "compatibility",
    "dependencies",
    "verification"
  ],
  "properties": {
    "schema_version": {
      "const": 1
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]*\\.[a-z][a-z0-9_.-]*$",
      "maxLength": 120
    },
    "kind": {
      "enum": [
        "workflow",
        "block",
        "plugin"
      ]
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 600
    },
    "version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:[a-zA-Z0-9.+-]*)?$"
    },
    "publisher": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]*$"
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        }
      }
    },
    "license": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "source": {
      "type": "string",
      "pattern": "^https://",
      "maxLength": 1000
    },
    "documentation": {
      "type": "string",
      "pattern": "^https://",
      "maxLength": 1000
    },
    "parent": {
      "type": "string",
      "maxLength": 120
    },
    "distribution": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]+$",
      "maxLength": 120
    },
    "artifact": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "url",
        "sha256"
      ],
      "properties": {
        "url": {
          "type": "string",
          "pattern": "^https://",
          "maxLength": 2000
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      }
    },
    "compatibility": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sdk",
        "schema_versions"
      ],
      "properties": {
        "sdk": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "schema_versions": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "enum": [
              1,
              2
            ]
          }
        },
        "extension_api": {
          "const": 1
        }
      }
    },
    "dependencies": {
      "type": "array",
      "maxItems": 50,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "version"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      }
    },
    "verification": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "checks"
      ],
      "properties": {
        "status": {
          "enum": [
            "unverified",
            "author-tested"
          ]
        },
        "checks": {
          "type": "array",
          "maxItems": 50,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "evidence": {
          "type": "string",
          "pattern": "^https://",
          "maxLength": 1000
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "status": {
                "const": "author-tested"
              }
            }
          },
          "then": {
            "required": [
              "evidence"
            ],
            "properties": {
              "checks": {
                "minItems": 1
              }
            }
          }
        }
      ]
    }
  }
}
