{
  "schemaVersion": 1,
  "slug": "vat-tax-calculator",
  "category": "finance",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "67c1f1938d5525867bf24ad8fb00aeb7e4e93f9591639af52c9f61b0e4c4a802",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/vat-tax-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": "add: G = N×(1+r÷100); remove: N = G÷(1+r÷100); V = G−N",
    "vars": [
      [
        "N",
        "Net amount"
      ],
      [
        "G",
        "Gross amount"
      ],
      [
        "r",
        "VAT rate (%)"
      ],
      [
        "V",
        "VAT amount"
      ]
    ],
    "note": "In add mode amount is net and G is computed; in remove mode amount is gross and N is computed; currency follows the amount input."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "if(mode === 'remove'){ const net = amount/(1+vatRate/100); return { net, vat: amount-net, gross: amount }; } const vat = amount*vatRate/100; return { net: amount, vat, gross: amount+vat };",
    "inputs": [
      {
        "name": "amount",
        "type": "number",
        "default": 100,
        "min": 0,
        "max": 1000000000,
        "step": 1
      },
      {
        "name": "vatRate",
        "type": "number",
        "default": 20,
        "min": 0,
        "max": 50,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "mode",
        "type": "select",
        "default": "add",
        "options": [
          {
            "value": "add"
          },
          {
            "value": "remove"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "net",
        "precision": 2,
        "unit": ""
      },
      {
        "name": "vat",
        "precision": 2,
        "unit": ""
      },
      {
        "name": "gross",
        "precision": 2,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
