{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schemaVersion": {
      "type": "number",
      "const": 1
    },
    "kind": {
      "type": "string",
      "const": "scenario"
    },
    "workspaceType": {
      "type": "string",
      "enum": [
        "local",
        "always-on"
      ]
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512
    },
    "definitionId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512
    },
    "harness": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        },
        "config": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "required": [
        "id"
      ],
      "additionalProperties": false
    },
    "lock": {
      "type": "object",
      "properties": {
        "required": {
          "type": "boolean",
          "const": true
        }
      },
      "required": [
        "required"
      ],
      "additionalProperties": false
    },
    "dependencies": {
      "maxItems": 256,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "kind": {
            "type": "string",
            "const": "local"
          },
          "version": {
            "type": "string",
            "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[a-zA-Z0-9.-]+)?$"
          },
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "requires": {
            "maxItems": 256,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          }
        },
        "required": [
          "id",
          "kind",
          "version",
          "path",
          "sha256"
        ],
        "additionalProperties": false
      }
    },
    "instructions": {
      "maxItems": 32,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 512
      }
    },
    "skills": {
      "maxItems": 256,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "required": [
          "path"
        ],
        "additionalProperties": false
      }
    },
    "context": {
      "type": "object",
      "properties": {
        "manifest": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "required": [
        "manifest"
      ],
      "additionalProperties": false
    },
    "scenario": {
      "type": "object",
      "properties": {
        "config": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "required": [
        "config"
      ],
      "additionalProperties": false
    },
    "connections": {
      "maxItems": 128,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "kind": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "definition": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "required": [
          "id",
          "kind",
          "definition"
        ],
        "additionalProperties": false
      }
    },
    "models": {
      "type": "object",
      "properties": {
        "policy": {
          "type": "string",
          "enum": [
            "required",
            "selectable"
          ]
        },
        "ref": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "required": [
        "policy"
      ],
      "additionalProperties": false
    },
    "parameters": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "pattern": "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "string",
              "number",
              "boolean"
            ]
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "required": {
            "type": "boolean"
          },
          "default": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 8192
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              }
            ]
          }
        },
        "required": [
          "type"
        ],
        "additionalProperties": false
      }
    },
    "actions": {
      "type": "object",
      "properties": {
        "config": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "required": [
        "config"
      ],
      "additionalProperties": false
    },
    "environment": {
      "type": "object",
      "properties": {
        "allow": {
          "maxItems": 128,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        },
        "config": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "additionalProperties": false
    },
    "files": {
      "type": "object",
      "properties": {
        "include": {
          "maxItems": 256,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          }
        }
      },
      "required": [
        "include"
      ],
      "additionalProperties": false
    },
    "showcase": {
      "type": "object",
      "properties": {
        "manifest": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "required": [
        "manifest"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "schemaVersion",
    "kind",
    "workspaceType",
    "name",
    "definitionId"
  ],
  "additionalProperties": {},
  "$id": "https://get3w.com/docs/schemas/workspace/v1/get3w.schema.json",
  "title": "Get3W workspace manifest v1",
  "description": "Structural schema. Runtime validation additionally checks safe workspace-relative paths, supported capabilities, unique references and dependency closure."
}
