{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "$id": "https://artifacts.apis.io/folio/json-schema/folio-contribution-dto-schema.json",
  "title": "contributionDTO",
  "description": "INN-Reach contribution job execution status tracking and basic statistics",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/folio-contributions-api-openapi.yml#/components/schemas/contributionDTO",
  "type": "object",
  "properties": {
    "id": {
      "description": "Contribution id",
      "type": "string",
      "format": "uuid"
    },
    "jobId": {
      "description": "Instance iteration job id",
      "type": "string",
      "format": "uuid"
    },
    "itemTypeMappingStatus": {
      "description": "Material type mapping validation status",
      "$ref": "#/$defs/mappingValidationStatusDTO",
      "default": "Invalid"
    },
    "locationsMappingStatus": {
      "description": "Location mapping validation status",
      "$ref": "#/$defs/mappingValidationStatusDTO",
      "default": "Invalid"
    },
    "status": {
      "description": "Status",
      "type": "string",
      "enum": [
        "In Progress",
        "Complete",
        "Not started",
        "Cancelled"
      ],
      "default": "Not started"
    },
    "contributionStarted": {
      "description": "Date and time when the contribution has started",
      "type": "string",
      "format": "date-time"
    },
    "contributionStartedBy": {
      "description": "Username of the user who started the contribution",
      "type": "string"
    },
    "contributionComplete": {
      "description": "Date and time when the contribution has completed",
      "type": "string",
      "format": "date-time"
    },
    "recordsTotal": {
      "description": "Total number of FOLIO instance records",
      "type": "integer",
      "format": "int64"
    },
    "recordsProcessed": {
      "description": "Total number of Processed records",
      "type": "integer",
      "format": "int64"
    },
    "recordsContributed": {
      "description": "Total number of Contributed records",
      "type": "integer",
      "format": "int64"
    },
    "recordsUpdated": {
      "description": "Total number of Updated records",
      "type": "integer",
      "format": "int64"
    },
    "recordsDecontributed": {
      "description": "Total number of De-contributed records",
      "type": "integer",
      "format": "int64",
      "readOnly": true
    },
    "errors": {
      "description": "List of errors occurred",
      "type": "array",
      "items": {
        "$ref": "#/$defs/contributionErrorDTO"
      }
    },
    "metadata": {
      "description": "Entity metadata",
      "type": "object",
      "$ref": "#/$defs/metadata"
    }
  },
  "additionalProperties": false,
  "required": [
    "status",
    "itemTypeMappingStatus",
    "locationsMappingStatus"
  ],
  "$defs": {
    "contributionErrorDTO": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "description": "INN-Reach contribution job execution status tracking and basic statistics",
      "type": "object",
      "properties": {
        "id": {
          "description": "Contribution id",
          "type": "string",
          "format": "uuid"
        },
        "message": {
          "description": "Error message (cause)",
          "type": "string"
        },
        "recordId": {
          "description": "Id of instance record which has not been processed due to error",
          "type": "string",
          "format": "uuid"
        }
      },
      "additionalProperties": false,
      "required": [
        "message",
        "recordId"
      ]
    },
    "mappingValidationStatusDTO": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "description": "Mapping validation status",
      "type": "string",
      "enum": [
        "Valid",
        "Invalid"
      ],
      "additionalProperties": false
    },
    "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"
      ]
    }
  }
}