{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "eventId": {
      "$ref": "#/definitions/uuid",
      "description": "event identification"
    },
    "eventType": {
      "type": "string",
      "description": "for this type of event it is always - attachments_updated"
    },
    "payloadVersion": {
      "type": "string",
      "description": "format - 1.0.0"
    },
    "correlationId": {
      "type": "string",
      "description": "id used to correlate behavior in backend system"
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "format - yyyy-MM-dd'T'HH:mm:ss.SSSZ"
    },
    "case": {
      "$ref": "#/definitions/case"
    },
    "changes": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/attachmentsUpdated"
      }
    }
  },
  "required": [
    "eventId",
    "eventType",
    "payloadVersion",
    "timestamp",
    "case"
  ],
  "definitions": {
    "uuid": {
      "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}$"
    },
    "case": {
      "type": "object",
      "properties": {
        "uuid": {
          "$ref": "#/definitions/uuid"
        },
        "number": {
          "type": "string",
          "description": "claim number, max size = 50"
        },
        "token": {
          "type": "string",
          "description": "unique identifier for a claim, format - c.20ea9579-6ae7-4022-a6e6-334c90390051"
        },
        "caseType": {
          "type": "string",
          "description": "e.g.: privateMedicalInsuranceClaim, motorClaim, buildingClaim, buildingRiskAssessment, contentClaim, contentItemization"
        },
        "externalClaimId": {
          "type": "string",
          "description": "internal case number of the insurance company, max size = 50"
        },
        "customerId": {
          "type": "string",
          "description": "customer Id received from the Unified Integrations Case create API"
        },
        "sourceSystem": {
          "type": "string"
        }
      },
      "required": [
        "uuid",
        "token",
        "number"
      ]
    },
    "attachmentsUpdated": {
      "type": "object",
      "properties": {
        "property": {
          "type": "string",
          "enum": [
            "attachmentAddedToClaimLevel",
            "attachmentDeletedFromClaimLevel",
            "attachmentAddedToClaimLineLevel",
            "attachmentUnlinkedFromClaimLineLevel",
            "attachmentAddedFromClaimLineLevelToClaimLineLevel",
            "attachmentAddedFromClaimLevelToClaimLineLevel",
            "attachmentImportedFromSelfService",
            "attachmentImportedFromFNOL"
          ]
        },
        "attachmentGUID" : {
          "type" : "string"
        },
        "attachmentLink" : {
          "type" : "string"
        },
        "fileType" : {
          "type" : "string"
        },
        "fileName" : {
          "type" : "string"
        }
      },
      "required": [
        "property",
        "attachmentGUID",
        "attachmentLink"
      ]
    }
  }
}
