{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sendletter-eu/json-schema/sendletter-eu-saved-address-schema.json",
  "title": "SavedAddress",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sendletter-eu-openapi.json#/components/schemas/SavedAddress",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "label": {
      "type": "string",
      "description": "What the customer calls it."
    },
    "kind": {
      "type": "string",
      "enum": [
        "sender",
        "recipient"
      ]
    },
    "address": {
      "$ref": "#/$defs/Address"
    },
    "isDefault": {
      "type": "boolean",
      "description": "At most one per kind. Setting it clears the flag from the others."
    },
    "usedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  },
  "$defs": {
    "Address": {
      "type": "object",
      "required": [
        "name",
        "street",
        "number",
        "postalCode",
        "city",
        "country"
      ],
      "properties": {
        "company": {
          "type": "string",
          "description": "Optional. Printed above the name."
        },
        "name": {
          "type": "string"
        },
        "street": {
          "type": "string"
        },
        "number": {
          "type": "string",
          "description": "House number, kept separate for countries that put it first."
        },
        "addition": {
          "type": "string",
          "description": "Optional. Suffix, floor, or care-of line."
        },
        "postalCode": {
          "type": "string",
          "description": "Normalised per country. 1234AB becomes 1234 AB."
        },
        "city": {
          "type": "string"
        },
        "province": {
          "type": "string",
          "description": "Required in Italy and Spain, ignored elsewhere."
        },
        "country": {
          "type": "string",
          "minLength": 2,
          "maxLength": 2,
          "enum": [
            "NL",
            "DE",
            "BE",
            "AT",
            "FR",
            "ES",
            "IT",
            "LU",
            "GB",
            "IE",
            "PT",
            "CH",
            "PL",
            "DK",
            "SE",
            "NO",
            "HU",
            "SI",
            "BG",
            "HR",
            "ZA",
            "FI",
            "EE",
            "LT",
            "TR",
            "MX",
            "KR",
            "RO",
            "SG",
            "CN",
            "CZ",
            "SK",
            "GR",
            "IS",
            "LV",
            "US",
            "CA",
            "JP",
            "BR",
            "IL",
            "IN"
          ]
        }
      }
    }
  }
}