{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/altruistiq/main/json-schema/altruistiq-facility-schema.json",
  "title": "Altruistiq Facility",
  "description": "A manufacturing or operational facility in the Altruistiq platform. Facilities have persistent properties and time-bound Versions.",
  "type": "object",
  "required": ["name"],
  "properties": {
    "id": { "type": "string" },
    "name": { "type": "string" },
    "type": { "type": "string", "description": "Facility type (Manufacturing, Warehouse, Office, etc.)." },
    "countryCode": { "type": "string", "description": "ISO 3166-1 alpha-2 country code." },
    "subdivisionCode": { "type": "string", "description": "ISO 3166-2 subdivision code." },
    "businessUnitId": { "type": "string" },
    "persistent": {
      "type": "object",
      "description": "Properties that persist across versions of the facility.",
      "additionalProperties": true
    },
    "currentVersion": {
      "type": "object",
      "properties": {
        "id": { "type": "string" },
        "validFrom": { "type": "string", "format": "date" },
        "validTo": { "type": "string", "format": "date" }
      }
    }
  }
}
