{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "PMDR Template Variables",
  "description": "Schema for Product Management Decision Record template variables",
  "type": "object",
  "required": ["number", "title", "status", "owner", "stakeholders", "context", "decision", "businessImpact", "successMetrics"],
  "properties": {
    "number": {
      "type": "integer",
      "minimum": 1,
      "description": "PMDR number for ordering and reference"
    },
    "title": {
      "type": "string",
      "minLength": 5,
      "maxLength": 150,
      "description": "Title of the product decision"
    },
    "status": {
      "type": "string",
      "enum": ["Draft", "Under Review", "Approved", "Rejected", "Superseded"],
      "description": "Current status of the decision"
    },
    "owner": {
      "type": "string",
      "minLength": 1,
      "description": "Decision owner (typically PM)"
    },
    "stakeholders": {
      "type": "array",
      "minItems": 1,
      "items": { "type": "string" },
      "description": "List of stakeholders involved"
    },
    "context": {
      "type": "string",
      "minLength": 20,
      "description": "Business context for the decision"
    },
    "currentState": {
      "type": "string",
      "description": "Description of current state"
    },
    "problemStatement": {
      "type": "string",
      "description": "The problem being addressed"
    },
    "decision": {
      "type": "string",
      "minLength": 20,
      "description": "The product decision being made"
    },
    "rationale": {
      "type": "string",
      "description": "Reasoning behind the decision"
    },
    "businessImpact": {
      "type": "string",
      "minLength": 20,
      "description": "Expected impact on the business"
    },
    "revenueImplications": {
      "type": "string",
      "description": "Expected revenue impact"
    },
    "costImplications": {
      "type": "string",
      "description": "Cost implications of the decision"
    },
    "customerImpact": {
      "type": "string",
      "description": "Impact on customers"
    },
    "successMetrics": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["metric", "target"],
        "properties": {
          "metric": {
            "type": "string",
            "description": "Metric name"
          },
          "current": {
            "type": "string",
            "description": "Current value"
          },
          "target": {
            "type": "string",
            "description": "Target value"
          },
          "timeline": {
            "type": "string",
            "description": "Timeline for achieving target"
          }
        }
      },
      "description": "Success metrics with targets"
    },
    "implementationPhases": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": { "type": "string" },
          "duration": { "type": "string" },
          "description": { "type": "string" }
        }
      },
      "description": "Implementation phases"
    },
    "dependencies": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Dependencies for implementation"
    },
    "risks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["risk"],
        "properties": {
          "risk": { "type": "string" },
          "impact": { "type": "string" },
          "mitigation": { "type": "string" }
        }
      },
      "description": "Identified risks"
    },
    "alternatives": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name", "description"],
        "properties": {
          "name": { "type": "string" },
          "description": { "type": "string" },
          "whyNot": { "type": "string" }
        }
      },
      "description": "Alternative options considered"
    },
    "approvals": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["stakeholder", "decision"],
        "properties": {
          "stakeholder": { "type": "string" },
          "decision": {
            "type": "string",
            "enum": ["Approved", "Rejected", "Pending"]
          },
          "date": { "type": "string" },
          "notes": { "type": "string" }
        }
      },
      "description": "Approval tracking"
    },
    "relatedPMDRs": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["number", "title"],
        "properties": {
          "number": { "type": "integer" },
          "title": { "type": "string" }
        }
      },
      "description": "Related PMDR references"
    }
  }
}
