# Copyright 2020 - 2021 PeopleWare n.v.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

type: object
required:
  - line1
  - postalCode
  - municipality
  - country
properties:
  line1:
    allOf:
      - $ref: '../string/TrimmedString.yaml'
      - description: First address line. Used together with `line2`. Not empty. Trimmed.
  line2:
    allOf:
      - $ref: '../string/TrimmedString.yaml'
      - description: Second address line. Used together with `line1`. Not empty. Trimmed.
  postalCode:
    type: string
    description: >-
      For some well-known `country`s, a pattern is enforced. E.g., for `BE`, the pattern is `^[1-9]\d{3}&`. Not empty.
      Trimmed.
    example: '2500'
  municipality:
    allOf:
      - $ref: '../string/TrimmedString.yaml'
      - description: >-
          Name of the municipality of the address. Essentially free text (it is impossible in practice to validate
          this). Not empty. Trimmed.
  country:
    $ref: 'Country.yaml'
example:
  line1: Duwijckstraat 17
  postalCode: '2500'
  municipality: Lier
  country: BE
