{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:coos:schema:common",
  "title": "Shared definitions",
  "description": "Reusable data types referenced by every entity schema in the Common Ownership Operating Schema.",
  "$defs": {
    "Identifier": {
      "title": "Identifier",
      "description": "An opaque, stable identifier assigned by the system that holds the record. Identifiers are unique within a data set and carry no meaning of their own.",
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9._:-]+$"
    },
    "Date": {
      "title": "Date",
      "description": "A calendar date in ISO 8601 extended format (YYYY-MM-DD).",
      "type": "string",
      "format": "date"
    },
    "DateTime": {
      "title": "DateTime",
      "description": "A date and time in RFC 3339 format, including a UTC offset (for example 2026-03-14T19:00:00-07:00).",
      "type": "string",
      "format": "date-time"
    },
    "Money": {
      "title": "Money",
      "description": "A monetary amount. The amount is a decimal string to avoid floating-point rounding errors.",
      "type": "object",
      "required": ["amount", "currency"],
      "additionalProperties": false,
      "properties": {
        "amount": {
          "description": "Decimal amount with up to two fractional digits. Negative values are permitted where the field description allows them.",
          "type": "string",
          "pattern": "^-?[0-9]+(\\.[0-9]{1,2})?$"
        },
        "currency": {
          "description": "ISO 4217 currency code. Only CAD is currently defined.",
          "type": "string",
          "enum": ["CAD"]
        }
      }
    },
    "Address": {
      "title": "Address",
      "description": "A Canadian civic or mailing address.",
      "type": "object",
      "required": ["streetAddress", "locality", "region", "postalCode", "country"],
      "additionalProperties": false,
      "properties": {
        "unitDesignator": { "description": "Unit, suite or apartment designator, if any (for example \"1203\").", "type": "string", "maxLength": 32 },
        "streetAddress": { "description": "Civic number and street name.", "type": "string", "minLength": 1, "maxLength": 200 },
        "locality": { "description": "Municipality or community.", "type": "string", "minLength": 1, "maxLength": 100 },
        "region": { "description": "Province or territory code. Strata records are expected to use BC, but mailing addresses may be elsewhere.", "type": "string", "pattern": "^[A-Z]{2}$" },
        "postalCode": { "description": "Canadian postal code in the form A1A 1A1.", "type": "string", "pattern": "^[A-Z][0-9][A-Z] ?[0-9][A-Z][0-9]$" },
        "country": { "description": "ISO 3166-1 alpha-2 country code.", "type": "string", "pattern": "^[A-Z]{2}$" }
      }
    },
    "StrataPlanNumber": {
      "title": "StrataPlanNumber",
      "description": "The strata plan number as registered with the Land Title Office: an alphabetic prefix followed by digits (for example EPS1234, LMS567, VIS890, VR12). Normalise to upper case without spaces.",
      "type": "string",
      "pattern": "^[A-Z]{2,4}[0-9]{1,6}$"
    },
    "ParcelIdentifier": {
      "title": "ParcelIdentifier",
      "description": "BC Parcel Identifier (PID) in the form 123-456-789.",
      "type": "string",
      "pattern": "^[0-9]{3}-[0-9]{3}-[0-9]{3}$"
    },
    "Extensions": {
      "title": "Extensions",
      "description": "Implementation-specific data that is not part of the standard. Keys must be reverse-domain namespaces owned by the implementer (for example \"ca.example.app\"), so extensions from different vendors never collide.",
      "type": "object",
      "propertyNames": { "pattern": "^[a-z0-9-]+(\\.[a-z0-9-]+)+$" },
      "additionalProperties": { "type": "object" }
    }
  }
}
