{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://klarfort.com/tools/retirement-calculator/schema.json",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "currency": {
      "type": "string",
      "title": "Currency",
      "description": "Currency",
      "enum": [
        "USD",
        "EUR",
        "GBP",
        "JPY",
        "CHF",
        "CAD",
        "AUD",
        "CNY",
        "INR",
        "MXN",
        "BRL",
        "SGD",
        "HKD",
        "SEK",
        "NOK",
        "DKK",
        "NZD",
        "ZAR",
        "KRW",
        "TRY",
        "PLN",
        "CZK",
        "HUF",
        "AED",
        "THB",
        "IDR",
        "MYR",
        "PHP"
      ],
      "default": "USD"
    },
    "principal": {
      "type": "number",
      "title": "Starting balance",
      "description": "Starting balance",
      "default": 10000,
      "minimum": 0,
      "maximum": 1000000000000
    },
    "months": {
      "type": "integer",
      "title": "Projection months",
      "description": "Projection months",
      "default": 12,
      "minimum": 1,
      "maximum": 600
    },
    "monthlyContribution": {
      "type": "number",
      "title": "Monthly contribution",
      "description": "Monthly contribution",
      "default": 0,
      "minimum": 0,
      "maximum": 1000000000000
    },
    "annualReturn": {
      "type": "number",
      "title": "Annual return (%)",
      "description": "Annual return (%)",
      "default": 0,
      "minimum": -99,
      "maximum": 100
    },
    "retirementMonth": {
      "type": "integer",
      "title": "First retirement month",
      "description": "First retirement month",
      "default": 1,
      "minimum": 1,
      "maximum": 601
    },
    "monthlyExpenses": {
      "type": "number",
      "title": "Monthly retirement spending",
      "description": "Monthly retirement spending",
      "default": 1000,
      "minimum": 0,
      "maximum": 1000000000000
    },
    "pensionStartMonth": {
      "type": "integer",
      "title": "First pension month",
      "description": "First pension month",
      "default": 1,
      "minimum": 1,
      "maximum": 601
    },
    "monthlyPension": {
      "type": "number",
      "title": "Monthly pension in today's money",
      "description": "Monthly pension in today's money",
      "default": 0,
      "minimum": 0,
      "maximum": 1000000000000
    },
    "annualVolatility": {
      "type": "number",
      "title": "Annual volatility (%)",
      "description": "Annual volatility (%)",
      "default": 0,
      "minimum": 0,
      "maximum": 200
    },
    "annualFee": {
      "type": "number",
      "title": "Annual asset fee (%)",
      "description": "Annual asset fee (%)",
      "default": 0,
      "minimum": 0,
      "maximum": 100
    },
    "taxRate": {
      "type": "number",
      "title": "Tax on positive gains (%)",
      "description": "Tax on positive gains (%)",
      "default": 0,
      "minimum": 0,
      "maximum": 100
    },
    "inflationRate": {
      "type": "number",
      "title": "Annual inflation (%)",
      "description": "Annual inflation (%)",
      "default": 0,
      "minimum": -99,
      "maximum": 100
    },
    "paths": {
      "type": "integer",
      "title": "Simulation paths",
      "description": "Simulation paths",
      "default": 1000,
      "minimum": 1,
      "maximum": 1000
    },
    "seed": {
      "type": "string",
      "title": "Simulation seed",
      "description": "Leave empty to derive a reproducible seed from your inputs, or enter 16 hexadecimal characters.",
      "default": "",
      "pattern": "^(?:[a-fA-F0-9]{16})?$"
    },
    "lifeStages": {
      "type": "array",
      "title": "Life stages",
      "description": "Optional nonoverlapping inclusive month ranges overriding retirement spending and adding other monthly income. Each amount is expressed in today's money.",
      "default": [],
      "maxItems": 20,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "startMonth": {
            "type": "integer",
            "title": "First month",
            "description": "First month",
            "default": 1,
            "minimum": 1,
            "maximum": 600
          },
          "endMonth": {
            "type": "integer",
            "title": "Last month",
            "description": "Last month",
            "default": 12,
            "minimum": 1,
            "maximum": 600
          },
          "monthlyExpenses": {
            "type": "number",
            "title": "Monthly expenses in today's money",
            "description": "Monthly expenses in today's money",
            "default": 0,
            "minimum": 0,
            "maximum": 1000000000000
          },
          "monthlyIncome": {
            "type": "number",
            "title": "Monthly other income in today's money",
            "description": "Monthly other income in today's money",
            "default": 0,
            "minimum": 0,
            "maximum": 1000000000000
          }
        },
        "required": [
          "startMonth",
          "endMonth",
          "monthlyExpenses",
          "monthlyIncome"
        ]
      }
    }
  },
  "required": [
    "currency",
    "principal",
    "months",
    "monthlyContribution",
    "annualReturn",
    "retirementMonth",
    "monthlyExpenses",
    "pensionStartMonth",
    "monthlyPension",
    "annualVolatility",
    "annualFee",
    "taxRate",
    "inflationRate",
    "paths",
    "seed",
    "lifeStages"
  ]
}