{
  "schemaVersion": 1,
  "slug": "oil-change-interval-calculator",
  "category": "automotive",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "9140f53f583fd2c8e375f1f1a2603f318cb0ea45a681f1634b67bcb787043a9b",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/oil-change-interval-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 = max(0, I − m)",
    "vars": [
      [
        "I",
        "Maintenance schedule interval (miles)"
      ],
      [
        "m",
        "Miles since last change"
      ],
      [
        "M",
        "Miles remaining"
      ]
    ],
    "note": "Mileage-only estimate; follow the vehicle schedule’s time or mileage limit, whichever comes first."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const out=(()=>{const adjustedInterval = interval; const milesRemaining = Math.max(0, adjustedInterval-milesSinceChange); return { adjustedInterval, milesRemaining };})();if(out.__error)return out;return {...out,__primary:milesSinceChange>interval?'milesOverdue':'milesRemaining',milesOverdue:Math.max(0,milesSinceChange-interval)};",
    "inputs": [
      {
        "name": "milesSinceChange",
        "type": "number",
        "default": 3000,
        "min": 0,
        "max": 30000,
        "step": 100,
        "requiredValue": true
      },
      {
        "name": "interval",
        "type": "number",
        "default": 7500,
        "min": 1000,
        "max": 25000,
        "step": 500,
        "requiredValue": true
      }
    ],
    "outputs": [
      {
        "name": "milesRemaining",
        "precision": 0,
        "unit": "mi",
        "trimTrailingZeros": true
      },
      {
        "name": "milesOverdue",
        "type": "number",
        "precision": 0,
        "unit": "mi",
        "showWhen": {},
        "trimTrailingZeros": true
      },
      {
        "name": "adjustedInterval",
        "precision": 0,
        "unit": "mi",
        "trimTrailingZeros": true
      }
    ],
    "interpret": null
  }
}
