{
  "schemaVersion": 1,
  "slug": "christmas-budget-calculator",
  "category": "party",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "2bd02ef49150516f5696740d94afb4f725997e34ab739046565bf3034f6f1b21",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/christmas-budget-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "T = n₁ g₁ + n₂ g₂ + f + d + t + c;  monthly = T ÷ 12",
    "vars": [
      [
        "T",
        "Total budget"
      ],
      [
        "n₁",
        "Regular recipients"
      ],
      [
        "g₁",
        "Average gift"
      ],
      [
        "n₂",
        "Close recipients"
      ],
      [
        "g₂",
        "Close gift"
      ],
      [
        "f",
        "Food and drink"
      ],
      [
        "d",
        "Decorations"
      ],
      [
        "t",
        "Travel"
      ],
      [
        "c",
        "Charity"
      ],
      [
        "monthly",
        "Monthly saving"
      ]
    ],
    "note": "Decorations (d), travel (t) and charity (c) are added directly; saving monthly divides the total by 12."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const empty={giftTotal:null,otherTotal:null,total:null,perRecipient:null,monthlySaving:null};if(!Number.isInteger(recipients)||!Number.isInteger(closeRecipients)||recipients<0||closeRecipients<0)return{...empty,__error:'inputError'};const gifts=recipients*avgGift+closeRecipients*closeGift;const other=foodDrink+decorations+travel+charity;const total=gifts+other;const n=recipients+closeRecipients;return{giftTotal:gifts,otherTotal:other,total,perRecipient:n>0?gifts/n:0,monthlySaving:total/12};",
    "inputs": [
      {
        "name": "recipients",
        "type": "number",
        "default": 12,
        "min": 0,
        "max": 300,
        "step": 1,
        "slider": true
      },
      {
        "name": "avgGift",
        "type": "number",
        "default": 35,
        "min": 0,
        "max": 10000,
        "step": 0.01
      },
      {
        "name": "closeRecipients",
        "type": "number",
        "default": 4,
        "min": 0,
        "max": 50,
        "step": 1,
        "slider": true
      },
      {
        "name": "closeGift",
        "type": "number",
        "default": 100,
        "min": 0,
        "max": 100000,
        "step": 0.01
      },
      {
        "name": "foodDrink",
        "type": "number",
        "default": 200,
        "min": 0,
        "max": 100000,
        "step": 1
      },
      {
        "name": "decorations",
        "type": "number",
        "default": 80,
        "min": 0,
        "max": 100000,
        "step": 1
      },
      {
        "name": "travel",
        "type": "number",
        "default": 150,
        "min": 0,
        "max": 1000000,
        "step": 1
      },
      {
        "name": "charity",
        "type": "number",
        "default": 50,
        "min": 0,
        "max": 100000,
        "step": 1
      }
    ],
    "outputs": [
      {
        "name": "giftTotal",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "otherTotal",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "total",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "perRecipient",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "monthlySaving",
        "precision": 2,
        "unit": "$"
      }
    ],
    "interpret": null
  }
}
