{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Epic Template Variables",
  "description": "Schema for Epic template variables",
  "type": "object",
  "required": ["id", "title", "status", "owner", "objective", "stories"],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^EPIC-[A-Z0-9]+$",
      "description": "Epic ID (e.g., EPIC-S3)"
    },
    "title": {
      "type": "string",
      "minLength": 5,
      "maxLength": 150,
      "description": "Epic title"
    },
    "status": {
      "type": "string",
      "enum": ["Planning", "In Progress", "Completed", "On Hold", "Cancelled"],
      "description": "Epic status"
    },
    "owner": {
      "type": "string",
      "minLength": 1,
      "description": "Epic owner"
    },
    "stakeholders": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Stakeholders"
    },
    "objective": {
      "type": "string",
      "minLength": 20,
      "description": "Epic objective/goal"
    },
    "businessValue": {
      "type": "string",
      "description": "Business value proposition"
    },
    "scope": {
      "type": "object",
      "properties": {
        "inScope": {
          "type": "array",
          "items": { "type": "string" }
        },
        "outOfScope": {
          "type": "array",
          "items": { "type": "string" }
        }
      },
      "description": "Epic scope definition"
    },
    "stories": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["id", "title"],
        "properties": {
          "id": {
            "type": "string",
            "description": "Story ID"
          },
          "title": {
            "type": "string",
            "description": "Story title"
          },
          "points": {
            "type": "integer",
            "description": "Story points"
          },
          "priority": {
            "type": "string",
            "description": "Priority"
          },
          "status": {
            "type": "string",
            "enum": ["Draft", "Ready", "In Progress", "In Review", "Blocked", "Done"]
          }
        }
      },
      "description": "Stories in this epic"
    },
    "sprints": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["number"],
        "properties": {
          "number": { "type": "integer" },
          "goal": { "type": "string" },
          "stories": {
            "type": "array",
            "items": { "type": "string" }
          }
        }
      },
      "description": "Sprint planning"
    },
    "successCriteria": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["criteria"],
        "properties": {
          "criteria": { "type": "string" },
          "metric": { "type": "string" },
          "target": { "type": "string" }
        }
      },
      "description": "Success criteria"
    },
    "risks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["risk"],
        "properties": {
          "risk": { "type": "string" },
          "impact": {
            "type": "string",
            "enum": ["Low", "Medium", "High", "Critical"]
          },
          "mitigation": { "type": "string" }
        }
      },
      "description": "Identified risks"
    },
    "dependencies": {
      "type": "object",
      "properties": {
        "dependsOn": {
          "type": "array",
          "items": { "type": "string" }
        },
        "blocks": {
          "type": "array",
          "items": { "type": "string" }
        }
      },
      "description": "Epic dependencies"
    },
    "technicalRequirements": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Technical requirements"
    },
    "documentation": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["type", "location"],
        "properties": {
          "type": { "type": "string" },
          "location": { "type": "string" },
          "status": { "type": "string" }
        }
      },
      "description": "Documentation requirements"
    },
    "progress": {
      "type": "object",
      "properties": {
        "totalPoints": { "type": "integer" },
        "completedPoints": { "type": "integer" },
        "percentComplete": { "type": "number" }
      },
      "description": "Epic progress tracking"
    }
  }
}
