{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://backpr.com/standard/v1/common.schema.json",
  "$comment": "Open Youth Registration format 1.x, BackPR, https://backpr.com/open-youth-registration. CC BY 4.0: https://creativecommons.org/licenses/by/4.0/",
  "title": "Common definitions",
  "description": "Shared types used by the other schemas.",
  "$defs": {
    "id": {
      "type": "string",
      "minLength": 1,
      "description": "Unique among objects of the same kind in the file. Keep it the same in every export from the same system so imports update records instead of duplicating them. Don't build IDs from names or birth dates."
    },
    "externalIds": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "system": {
            "type": "string",
            "description": "Where the ID comes from, for example a school district or another registration system."
          },
          "id": {
            "type": "string"
          }
        },
        "required": [
          "system",
          "id"
        ]
      }
    },
    "date": {
      "type": "string",
      "format": "date",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Calendar date, YYYY-MM-DD."
    },
    "dateTime": {
      "type": "string",
      "format": "date-time",
      "description": "Date and time with a time zone offset (ISO 8601), for example 2026-05-01T18:20:00Z."
    },
    "time": {
      "type": "string",
      "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
      "description": "Local time, HH:MM, 24-hour."
    },
    "phone": {
      "type": "object",
      "properties": {
        "number": {
          "type": "string",
          "description": "E.164 where possible, for example +15125550100."
        },
        "type": {
          "enum": [
            "mobile",
            "home",
            "work",
            "other"
          ]
        }
      },
      "required": [
        "number"
      ]
    },
    "address": {
      "type": "object",
      "properties": {
        "line1": {
          "type": "string"
        },
        "line2": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "state": {
          "type": "string",
          "description": "Two-letter USPS code for US addresses."
        },
        "postalCode": {
          "type": "string"
        },
        "country": {
          "type": "string",
          "pattern": "^[A-Z]{2}$",
          "description": "ISO 3166-1 alpha-2 code. If absent, US."
        }
      }
    },
    "money": {
      "type": "number",
      "description": "Amount in the file's currency, as a decimal number (for example 250.00)."
    },
    "language": {
      "type": "string",
      "description": "BCP 47 language tag, for example en or es."
    }
  }
}