{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.wtf-p.dev/project/config/v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "project_id",
    "interaction_mode",
    "depth",
    "output_format",
    "language",
    "gates",
    "workflow",
    "safety",
    "parallelism"
  ],
  "properties": {
    "schema": { "const": "wtfp.project.config/v1" },
    "project_id": { "$ref": "https://schemas.wtf-p.dev/project/common/v1#/$defs/identifier" },
    "interaction_mode": { "enum": ["guided", "standard", "autonomous"] },
    "depth": { "enum": ["quick", "standard", "comprehensive"] },
    "output_format": { "enum": ["markdown", "latex", "typst"] },
    "language": { "type": "string", "pattern": "^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$" },
    "citation_style": { "$ref": "https://schemas.wtf-p.dev/project/common/v1#/$defs/nonEmptyString" },
    "gates": {
      "type": "object",
      "additionalProperties": false,
      "required": ["confirm_outline", "confirm_plan", "confirm_write", "confirm_review", "confirm_delivery"],
      "properties": {
        "confirm_outline": { "type": "boolean" },
        "confirm_plan": { "type": "boolean" },
        "confirm_write": { "type": "boolean" },
        "confirm_review": { "type": "boolean" },
        "confirm_delivery": { "type": "boolean" }
      }
    },
    "workflow": {
      "type": "object",
      "additionalProperties": false,
      "required": ["research", "plan_validation", "argument_validation", "coherence_validation"],
      "properties": {
        "research": { "type": "boolean" },
        "plan_validation": { "type": "boolean" },
        "argument_validation": { "type": "boolean" },
        "coherence_validation": { "type": "boolean" }
      }
    },
    "safety": {
      "type": "object",
      "additionalProperties": false,
      "required": ["destructive_requires_authorization", "external_publish_requires_authorization", "backup_before_major_edits"],
      "properties": {
        "destructive_requires_authorization": { "const": true },
        "external_publish_requires_authorization": { "const": true },
        "backup_before_major_edits": { "type": "boolean" }
      }
    },
    "parallelism": {
      "type": "object",
      "additionalProperties": false,
      "required": ["enabled", "max_workers"],
      "properties": {
        "enabled": { "type": "boolean" },
        "max_workers": { "type": "integer", "minimum": 1, "maximum": 32 }
      }
    }
  }
}
