{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bountyapi-com/json-schema/bountyapi-com-invest-calc-result-schema.json",
  "title": "InvestCalcResult",
  "description": "Response model for the investment-growth calculation.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/bountyapi-com-api-openapi.json#/components/schemas/InvestCalcResult",
  "properties": {
    "principal": {
      "type": "number",
      "title": "Principal"
    },
    "annual_rate": {
      "type": "number",
      "title": "Annual Rate"
    },
    "years": {
      "type": "integer",
      "title": "Years"
    },
    "contribution_monthly": {
      "type": "number",
      "title": "Contribution Monthly"
    },
    "contribution_frequency": {
      "$ref": "#/$defs/ContributionFrequency"
    },
    "interest_type": {
      "$ref": "#/$defs/InterestType"
    },
    "compounding_frequency": {
      "$ref": "#/$defs/CompoundingFrequency"
    },
    "final_balance": {
      "type": "number",
      "title": "Final Balance"
    },
    "total_contributed": {
      "type": "number",
      "title": "Total Contributed",
      "description": "All money deposited: principal + every recurring contribution."
    },
    "total_interest_earned": {
      "type": "number",
      "title": "Total Interest Earned",
      "description": "final_balance − total_contributed."
    },
    "multiplier": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Multiplier",
      "description": "final_balance / principal. None when principal is 0."
    },
    "yearly_growth": {
      "items": {
        "$ref": "#/$defs/YearRow"
      },
      "type": "array",
      "title": "Yearly Growth"
    },
    "source": {
      "type": "string",
      "title": "Source"
    },
    "calculation_date": {
      "type": "string",
      "title": "Calculation Date"
    }
  },
  "type": "object",
  "required": [
    "principal",
    "annual_rate",
    "years",
    "contribution_monthly",
    "contribution_frequency",
    "interest_type",
    "compounding_frequency",
    "final_balance",
    "total_contributed",
    "total_interest_earned",
    "yearly_growth",
    "source",
    "calculation_date"
  ],
  "$defs": {
    "CompoundingFrequency": {
      "type": "string",
      "enum": [
        "monthly",
        "annually",
        "quarterly",
        "daily",
        "continuous"
      ],
      "title": "CompoundingFrequency",
      "description": "Compounding cadence for compound interest (ignored for simple interest)."
    },
    "ContributionFrequency": {
      "type": "string",
      "enum": [
        "monthly",
        "annual"
      ],
      "title": "ContributionFrequency",
      "description": "Cadence at which `contribution_monthly` is added to the balance."
    },
    "InterestType": {
      "type": "string",
      "enum": [
        "simple",
        "compound"
      ],
      "title": "InterestType",
      "description": "Whether interest accrues linearly (simple) or on prior interest (compound)."
    },
    "YearRow": {
      "properties": {
        "year": {
          "type": "integer",
          "title": "Year",
          "description": "Year number (1-based)."
        },
        "balance": {
          "type": "number",
          "title": "Balance",
          "description": "Balance at the end of the year."
        },
        "contributions_so_far": {
          "type": "number",
          "title": "Contributions So Far",
          "description": "Total money deposited up to and including this year (principal + recurring contributions)."
        },
        "interest_earned": {
          "type": "number",
          "title": "Interest Earned",
          "description": "Cumulative interest earned as of the end of this year (= balance − contributions_so_far)."
        }
      },
      "type": "object",
      "required": [
        "year",
        "balance",
        "contributions_so_far",
        "interest_earned"
      ],
      "title": "YearRow",
      "description": "One row of the yearly growth table."
    }
  }
}