{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.aitraining2u.com/casestudies/retail/demo/decision-list.schema.json",
  "title": "RetailDailyDecisionList",
  "description": "The artefact CSOA composes every morning at 06:00 MYT and the CEO opens. Each list has a tier snapshot and a ranked array of 3-7 decision entries.",
  "type": "object",
  "required": ["date", "executive", "tier_snapshot", "p_and_l_24h", "decisions"],
  "properties": {
    "date": {
      "type": "string",
      "format": "date",
      "description": "Date the list is for (the day the CEO opens it)."
    },
    "executive": {
      "type": "string",
      "description": "The recipient — for retail this is 'CEO'."
    },
    "p_and_l_24h": {
      "type": "object",
      "required": ["upside_rm", "downside_rm_risk"],
      "properties": {
        "upside_rm": {"type": "number", "description": "Sum of expected positive RM-impact across all approve-action items."},
        "downside_rm_risk": {"type": "number", "description": "Sum of expected negative RM-impact if the Esc items are not addressed."}
      }
    },
    "tier_snapshot": {
      "type": "object",
      "required": ["over_performing", "on_target", "under_performing", "total"],
      "properties": {
        "over_performing": {"type": "integer", "description": "Sites in top decile of cohort-matched performance."},
        "on_target": {"type": "integer", "description": "Sites at or near cohort median."},
        "under_performing": {"type": "integer", "description": "Sites in bottom decile."},
        "total": {"type": "integer", "description": "Total sites across the network."}
      }
    },
    "decisions": {
      "type": "array",
      "minItems": 3,
      "maxItems": 7,
      "items": {"$ref": "#/$defs/Decision"}
    }
  },
  "$defs": {
    "Decision": {
      "type": "object",
      "required": ["decision_id", "priority", "decision", "agents_involved", "rm_impact", "why", "recommended_action"],
      "properties": {
        "decision_id": {
          "type": "string",
          "pattern": "^DEC-retail-[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]+$",
          "description": "Stable ID, deterministic from date + ordinal."
        },
        "priority": {
          "enum": ["P0", "P1", "P2", "Esc"],
          "description": "P0=immediate · P1=this week · P2=this month · Esc=escalate to CEO."
        },
        "decision": {
          "type": "string",
          "maxLength": 240,
          "description": "One sentence the CEO can read in under 5 seconds."
        },
        "agents_involved": {
          "type": "array",
          "minItems": 1,
          "items": {"enum": ["DDPA", "ILA", "HCOA", "FOA", "SPPA", "CSOA"]}
        },
        "rm_impact": {
          "type": "number",
          "description": "Signed. Positive = approve gives upside; negative = if not addressed, this is the loss."
        },
        "why": {
          "type": "string",
          "description": "One line tying the recommendation back to the signals it came from."
        },
        "recommended_action": {
          "enum": ["approve", "defer", "escalate"],
          "description": "What CSOA recommends. The CEO can override."
        },
        "proof_links": {
          "type": "array",
          "items": {"type": "string"},
          "description": "URLs / Obsidian paths the CEO can open to drill into the data."
        }
      }
    }
  }
}
