{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "TASK_CONTRACT",
  "type": "object",
  "required": [
    "source_platform",
    "source_reference",
    "task_type",
    "goal",
    "business_context",
    "repo_targets",
    "in_scope",
    "out_of_scope",
    "constraints",
    "affected_contracts",
    "backward_compatibility",
    "acceptance_criteria",
    "test_plan",
    "manual_plan",
    "risk_level"
  ],
  "properties": {
    "source_platform": {
      "type": "string",
      "minLength": 1
    },
    "source_reference": {
      "type": "string",
      "minLength": 1
    },
    "requester": {
      "type": "string"
    },
    "task_type": {
      "type": "string",
      "enum": [
        "bugfix",
        "feature",
        "refactor",
        "hardening",
        "ops",
        "docs"
      ]
    },
    "goal": {
      "type": "string",
      "minLength": 1
    },
    "business_context": {
      "type": "string",
      "minLength": 1
    },
    "repo_targets": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    },
    "in_scope": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    },
    "out_of_scope": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "constraints": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "affected_contracts": {
      "type": "object",
      "required": [
        "api",
        "database",
        "events",
        "config",
        "sdk",
        "ui",
        "manual"
      ],
      "properties": {
        "api": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "database": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "events": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "config": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "sdk": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "ui": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "manual": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "backward_compatibility": {
      "type": "string",
      "enum": [
        "required",
        "preferred",
        "not_required"
      ]
    },
    "acceptance_criteria": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    },
    "test_plan": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    },
    "manual_plan": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    },
    "release_plan": {
      "type": "string"
    },
    "rollback_plan": {
      "type": "string"
    },
    "observability": {
      "type": "string"
    },
    "risk_level": {
      "type": "string",
      "enum": [
        "low",
        "medium",
        "high"
      ]
    },
    "assumptions": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "open_questions": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "additionalProperties": false
}
