{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/moneyhub/main/json-schema/moneyhub-savings-goals-post-schema.json",
  "title": "SavingsGoalsPost",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/moneyhub-savings-goals-api-openapi.yml#/components/schemas/SavingsGoalsPost",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "name": {
      "description": "Name for the savings goal.",
      "type": "string"
    },
    "amount": {
      "properties": {
        "value": {
          "description": "The target amount in minor unit in minor units of the currency, eg. pennies for GBP.",
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "currency": {
          "description": "The currency of the amount",
          "type": "string"
        }
      },
      "required": [
        "value"
      ],
      "additionalProperties": false,
      "type": "object"
    },
    "imageUrl": {
      "type": "string"
    },
    "notes": {
      "description": "Arbitrary text that a user can add about a savings goal.",
      "type": "string"
    },
    "targetDate": {
      "description": "The target date for the savings goal. Format YYYY-MM-DD. It must be today or in the future.",
      "type": "string",
      "format": "date"
    },
    "accounts": {
      "type": "array",
      "description": "Accounts that will be taken into account towards the target amount.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "description": "Id of the account",
            "type": "string"
          }
        },
        "required": [
          "id"
        ]
      },
      "minItems": 1
    }
  },
  "required": [
    "name",
    "amount",
    "accounts"
  ]
}