{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://alchemy.new/schema/v1/project.json",
  "$ref": "#/$defs/ProjectManifestEncoded",
  "$defs": {
    "ProjectPublisherEncoded": {
      "type": "object",
      "properties": {
        "name": { "type": "string" },
        "github": { "type": "string" },
        "website": { "type": "string" }
      },
      "required": ["name"],
      "additionalProperties": false
    },
    "GitSourceEncoded": {
      "type": "object",
      "properties": {
        "kind": { "type": "string", "enum": ["git"] },
        "url": { "type": "string" },
        "ref": { "type": "string" },
        "token": { "type": "string" }
      },
      "required": ["kind", "url"],
      "additionalProperties": false
    },
    "NpmSourceEncoded": {
      "type": "object",
      "properties": {
        "kind": { "type": "string", "enum": ["npm"] },
        "packageName": { "type": "string" },
        "version": { "type": "string" },
        "exportPath": { "type": "string" }
      },
      "required": ["kind", "packageName"],
      "additionalProperties": false
    },
    "Union_": { "type": "string", "enum": ["cloudflare", "aws", "other"] },
    "ProjectDeploymentEncoded": {
      "type": "object",
      "properties": {
        "entrypoint": { "type": "string" },
        "packageManager": { "type": "string", "enum": ["nub", "bun"] },
        "providers": { "type": "array", "items": { "$ref": "#/$defs/Union_" } },
        "defaultProvider": { "$ref": "#/$defs/Union_" },
        "defaultStage": { "type": "string" }
      },
      "required": ["entrypoint", "providers", "defaultProvider", "defaultStage"],
      "additionalProperties": false
    },
    "ProjectParameterEncoded": {
      "type": "object",
      "properties": {
        "name": { "type": "string" },
        "label": { "type": "string" },
        "description": { "type": "string" },
        "required": { "type": "boolean" },
        "secret": { "type": "boolean" },
        "type": { "type": "string", "enum": ["string", "number", "boolean", "select"] },
        "default": {
          "anyOf": [
            { "type": "string" },
            {
              "anyOf": [
                { "type": "number" },
                { "type": "string", "enum": ["Infinity", "-Infinity", "NaN"] }
              ]
            },
            { "type": "boolean" }
          ]
        },
        "options": {
          "type": "array",
          "items": {
            "anyOf": [
              { "type": "string" },
              {
                "anyOf": [
                  { "type": "number" },
                  { "type": "string", "enum": ["Infinity", "-Infinity", "NaN"] }
                ]
              },
              { "type": "boolean" }
            ]
          }
        }
      },
      "required": ["name", "label", "required", "secret"],
      "additionalProperties": false
    },
    "ProjectManifestEncoded": {
      "type": "object",
      "properties": {
        "$schema": { "type": "string" },
        "schemaVersion": { "type": "number", "enum": [1] },
        "id": { "type": "string" },
        "name": { "type": "string" },
        "description": { "type": "string" },
        "publisher": { "$ref": "#/$defs/ProjectPublisherEncoded" },
        "source": {
          "anyOf": [{ "$ref": "#/$defs/GitSourceEncoded" }, { "$ref": "#/$defs/NpmSourceEncoded" }]
        },
        "deployment": { "$ref": "#/$defs/ProjectDeploymentEncoded" },
        "parameters": { "type": "array", "items": { "$ref": "#/$defs/ProjectParameterEncoded" } },
        "tags": { "type": "array", "items": { "type": "string" } },
        "website": { "type": "string" }
      },
      "required": [
        "schemaVersion",
        "id",
        "name",
        "description",
        "publisher",
        "source",
        "deployment",
        "parameters"
      ],
      "additionalProperties": false
    }
  }
}
