{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "format": {
      "type": "string",
      "const": "methora.card/0.1"
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "intendedBuyer": {
      "type": "string",
      "maxLength": 400
    },
    "outcome": {
      "type": "string",
      "maxLength": 600
    },
    "scope": {
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 400
      }
    },
    "limitations": {
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 400
      }
    },
    "inputs": {
      "maxItems": 5,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9_]*$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "help": {
            "type": "string",
            "maxLength": 500
          },
          "required": {
            "type": "boolean"
          },
          "type": {
            "type": "string",
            "enum": [
              "short_text",
              "long_text",
              "single_choice",
              "multi_choice",
              "number",
              "data"
            ]
          },
          "options": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 300
                }
              },
              "required": [
                "id",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "maxChars": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "schema": {
            "$ref": "#/$defs/__schema0"
          }
        },
        "required": [
          "id",
          "label",
          "required",
          "type"
        ],
        "additionalProperties": false
      }
    },
    "outputs": {
      "maxItems": 12,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9_]*$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "help": {
            "type": "string",
            "maxLength": 1000
          },
          "required": {
            "type": "boolean"
          },
          "schema": {
            "$ref": "#/$defs/__schema0"
          }
        },
        "required": [
          "id",
          "label",
          "required",
          "schema"
        ],
        "additionalProperties": false
      }
    },
    "instructions": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 4000
      }
    },
    "resultOutline": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 300
      }
    },
    "sampleInput": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64
      },
      "additionalProperties": {
        "$ref": "#/$defs/__schema1"
      }
    },
    "price": {
      "type": "object",
      "properties": {
        "amountCents": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "currency": {
          "type": "string",
          "const": "eur"
        }
      },
      "required": [
        "amountCents",
        "currency"
      ],
      "additionalProperties": false
    },
    "storefront": {
      "type": "object",
      "properties": {
        "deliverable": {
          "type": "string",
          "minLength": 1,
          "maxLength": 400
        },
        "requiredInputs": {
          "type": "string",
          "maxLength": 400
        },
        "timing": {
          "type": "string",
          "maxLength": 400
        },
        "example": {
          "type": "string",
          "maxLength": 800
        }
      },
      "required": [
        "deliverable",
        "requiredInputs",
        "timing"
      ],
      "additionalProperties": false
    },
    "maxInputChars": {
      "default": 12000,
      "type": "integer",
      "minimum": 100,
      "maximum": 32000
    },
    "source": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "skill",
            "business",
            "other"
          ]
        },
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "type"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "format",
    "title",
    "intendedBuyer",
    "outcome",
    "scope",
    "limitations",
    "inputs",
    "instructions",
    "price"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "text"
            },
            "maxChars": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20000
            },
            "markdown": {
              "type": "boolean"
            }
          },
          "required": [
            "type"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "number"
            }
          },
          "required": [
            "type"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "boolean"
            }
          },
          "required": [
            "type"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "choice"
            },
            "options": {
              "maxItems": 50,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "maxLength": 64,
                    "pattern": "^[a-z][a-z0-9_]*$"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  }
                },
                "required": [
                  "id",
                  "label"
                ],
                "additionalProperties": false
              }
            },
            "multiple": {
              "type": "boolean"
            }
          },
          "required": [
            "type",
            "options"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "list"
            },
            "items": {
              "$ref": "#/$defs/__schema0"
            },
            "maxItems": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "type",
            "items"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "object"
            },
            "fields": {
              "maxItems": 30,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "maxLength": 64,
                    "pattern": "^[a-z][a-z0-9_]*$"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "help": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "schema": {
                    "$ref": "#/$defs/__schema0"
                  }
                },
                "required": [
                  "id",
                  "label",
                  "required",
                  "schema"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "type",
            "fields"
          ],
          "additionalProperties": false
        }
      ]
    },
    "__schema1": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema1"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema1"
          }
        }
      ]
    }
  }
}
