{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "$id": "https://artifacts.apis.io/folio/json-schema/folio-agency-location-mapping-dto-schema.json",
  "title": "agencyLocationMappingDTO",
  "description": "INN-Reach Agency to FOLIO locations mapping",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/folio-agency-mappings-api-openapi.yml#/components/schemas/agencyLocationMappingDTO",
  "type": "object",
  "properties": {
    "id": {
      "description": "Mapping id",
      "type": "string",
      "format": "uuid"
    },
    "locationId": {
      "description": "Location id",
      "type": "string",
      "format": "uuid"
    },
    "libraryId": {
      "description": "Location id",
      "type": "string",
      "format": "uuid"
    },
    "localServers": {
      "description": "Local server mappings",
      "type": "array",
      "items": {
        "$ref": "#/$defs/agencyLocationLscMappingDTO"
      }
    },
    "metadata": {
      "description": "Entity metadata",
      "type": "object",
      "$ref": "#/$defs/metadata"
    }
  },
  "additionalProperties": false,
  "required": [
    "locationId",
    "libraryId"
  ],
  "$defs": {
    "agencyLocationAcMappingDTO": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "description": "INN-Reach Agency to FOLIO location mapping",
      "type": "object",
      "properties": {
        "id": {
          "description": "Mapping id",
          "type": "string",
          "format": "uuid"
        },
        "agencyCode": {
          "description": "Agency code",
          "type": "string",
          "maxLength": 5
        },
        "locationId": {
          "description": "Location id",
          "type": "string",
          "format": "uuid"
        },
        "libraryId": {
          "description": "Library id",
          "type": "string",
          "format": "uuid"
        },
        "metadata": {
          "description": "Entity metadata",
          "type": "object",
          "$ref": "#/$defs/metadata"
        }
      },
      "additionalProperties": false,
      "required": [
        "agencyCode"
      ]
    },
    "agencyLocationLscMappingDTO": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "description": "INN-Reach Agency to FOLIO location mapping",
      "type": "object",
      "properties": {
        "id": {
          "description": "Mapping id",
          "type": "string",
          "format": "uuid"
        },
        "localCode": {
          "description": "Local server code",
          "type": "string",
          "maxLength": 5
        },
        "locationId": {
          "description": "Location id",
          "type": "string",
          "format": "uuid"
        },
        "libraryId": {
          "description": "Location id",
          "type": "string",
          "format": "uuid"
        },
        "agencyCodeMappings": {
          "description": "Agency code mappings",
          "type": "array",
          "items": {
            "$ref": "#/$defs/agencyLocationAcMappingDTO"
          }
        },
        "metadata": {
          "description": "Entity metadata",
          "type": "object",
          "$ref": "#/$defs/metadata"
        }
      },
      "additionalProperties": false,
      "required": [
        "localCode"
      ]
    },
    "metadata": {
      "title": "Metadata Schema",
      "description": "Metadata about creation and changes to records, provided by the server (client should not provide)",
      "type": "object",
      "properties": {
        "createdDate": {
          "description": "Date and time when the record was created",
          "type": "string",
          "format": "date-time"
        },
        "createdByUserId": {
          "description": "ID of the user who created the record (when available)",
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
        },
        "createdByUsername": {
          "description": "Username of the user who created the record (when available)",
          "type": "string"
        },
        "updatedDate": {
          "description": "Date and time when the record was last updated",
          "type": "string",
          "format": "date-time"
        },
        "updatedByUserId": {
          "description": "ID of the user who last updated the record (when available)",
          "type": "string",
          "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
        },
        "updatedByUsername": {
          "description": "Username of the user who last updated the record (when available)",
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "createdDate"
      ]
    }
  }
}