{
  "schemaVersion": 1,
  "slug": "car-lease-calculator",
  "category": "automotive",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "64cc22ab1720368a7f2247e00d015a043c6fb907c059cb8a79b15c91c0e4c28a",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/car-lease-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": "M = [(C − R) ÷ n + (C + R)·MF]·(1 + t ÷ 100);  C = P − D",
    "vars": [
      [
        "M",
        "Monthly lease payment"
      ],
      [
        "C",
        "Adjusted cap cost"
      ],
      [
        "R",
        "Residual value"
      ],
      [
        "n",
        "Lease term, months"
      ],
      [
        "MF",
        "Money factor"
      ],
      [
        "t",
        "Sales tax, %"
      ],
      [
        "P",
        "Negotiated vehicle price"
      ],
      [
        "D",
        "Down payment / cap-cost reduction"
      ]
    ],
    "note": "Monthly payment = depreciation + finance charge, then entered tax. Money factor × 2,400 is a rough rate equivalent, not a contract APR."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "if(price<=0||months<=0||downPayment>=price||residualPercent<0||residualPercent>100||moneyFactor<0) return {residualValue:null,depreciation:null,financeCharge:null,monthly:null,equivalentApr:null,totalCost:null,__error:'leaseInputs'}; const residualValue=price*residualPercent/100, cap=price-downPayment, depreciation=(cap-residualValue)/months, financeCharge=(cap+residualValue)*moneyFactor, base=depreciation+financeCharge, monthly=base*(1+salesTax/100); return {residualValue,depreciation,financeCharge,monthly,equivalentApr:moneyFactor*2400,totalCost:monthly*months+downPayment};",
    "inputs": [
      {
        "name": "price",
        "type": "number",
        "default": 38000,
        "min": 0,
        "max": 2000000,
        "step": 100
      },
      {
        "name": "residualPercent",
        "type": "number",
        "default": 55,
        "min": 10,
        "max": 90,
        "step": 1,
        "slider": true
      },
      {
        "name": "moneyFactor",
        "type": "number",
        "default": 0.00125,
        "min": 0,
        "max": 0.02,
        "step": 0.00001,
        "slider": true
      },
      {
        "name": "months",
        "type": "number",
        "default": 36,
        "min": 12,
        "max": 60,
        "step": 6
      },
      {
        "name": "downPayment",
        "type": "number",
        "default": 3000,
        "min": 0,
        "max": 500000,
        "step": 100
      },
      {
        "name": "salesTax",
        "type": "number",
        "default": 7,
        "min": 0,
        "max": 25,
        "step": 0.1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "monthly",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "totalCost",
        "precision": 0,
        "unit": "$"
      },
      {
        "name": "residualValue",
        "precision": 0,
        "unit": "$"
      },
      {
        "name": "depreciation",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "financeCharge",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "equivalentApr",
        "precision": 2,
        "unit": "%"
      }
    ],
    "interpret": null
  }
}
