{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "array",
    "minItems": 0,
    "_uniqueItems": true,
    "items": {
        "type": "object",
        "properties": {
            "lisaTransactionID": {
                "$ref": "#/definitions/IDType"
            },
            "accountID": {
                "$ref": "#/definitions/IDType"
            },
            "LISAManagerReferenceNumber": {
                "$ref": "#/definitions/LISAManagerReferenceNumberType"
            },
            "complianceReason": {
                "$ref": "#/definitions/complianceReasonType"
            },
            "transactionType": {
                "$ref": "#/definitions/lisaTransactionTypeType"
            },
            "dateSubmitted": {
                "$ref": "#/definitions/ISO8601-Timestamp"
            },
            "amount": {
                "type": "number"
            },
            "financialPeriod": {
                "$ref": "#/definitions/financialPeriodType"
            },
            "chargeDueTo": {
                "type": "object",
                "properties": {
                    "chargeReasonCode": {
                        "$ref": "#/definitions/chargeReasonCodeType"
                    },
                    "chargeReasontext": {
                        "type": "string"
                    },
                    "causingLISATransactionID": {
                        "$ref": "#/definitions/IDType"
                    },
                    "_links": {
                        "type": "object"
                    }
                },
                "required": [
                    "chargeReasonCode",
                    "chargeReasonText",
                    "causingLISATransactionID"
                ]
            },
            "transferFromLISA": {
                "type": "object",
                "properties": {
                    "LISAManagerReferenceNumber": {
                        "$ref": "#/definitions/LISAManagerReferenceNumberType"
                    },
                    "accountID": {
                        "$ref": "#/definitions/IDType"
                    },
                    "transferDate": {
                        "$ref": "#/definitions/ISO8601-Date"
                    },
                    "_links": {
                        "type": "object"
                    }
                },
                "required": [
                    "LISAManagerReferenceNumber",
                    "accountID",
                    "transferDate"
                ]
            },
            "incurredCharge": {
                "type": "object",
                "properties": {
                    "chargeLISATransactionID": {
                        "$ref": "#/definitions/IDType"
                    },
                    "_links": {
                        "type": "object"
                    }
                },
                "required": [
                    "chargeLISATransactionID"
                ]
            },
            "supersedesTransaction": {
                "type": "object",
                "properties": {
                    "supersededLISATransactionID": {
                        "$ref": "#/definitions/IDType"
                    },
                    "supersedeReasonCode": {
                        "$ref": "#/definitions/supersedeReasonCodeType"
                    },
                    "supersedeReasonText": {
                        "type": "string"
                    },
                    "_links": {
                        "type": "object"
                    }
                },
                "required": [
                    "supersededLISATransactionID",
                    "supersedeReasonCode",
                    "supersedeReasonText"
                ]
            },
            "_links": {
                "type": "object"
            }
        },
        "required": [
            "lisaTransactionID",
            "accountID",
            "LISAManagerReferenceNumber",
            "amount",
            "transactionType",
            "dateSubmitted",
            "financialPeriod"
        ],
        "additionalProperties": false
    },
    "definitions": {
        "ISO8601-Date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "ISO8601-Timestamp": {
            "type": "string",
            "pattern": "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2})?(([+-]\\d{2}(:\\d{2})?)|Z)"
        },
        "financialPeriodType": {
            "type": "object",
            "properties": {
                "startDate": {
                    "$ref": "#/definitions/ISO8601-Date"
                },
                "endDate": {
                    "$ref": "#/definitions/ISO8601-Date"
                }
            }
        },
        "IDType": {
            "type": "string",
            "pattern": "^\\d{10}$"
        },
        "LISAManagerReferenceNumberType": {
            "type": "string",
            "pattern": "^Z\\d{6}$"
        },
        "transactionTypeType": {
            "type": "string",
            "enum": [
                "bonus",
                "charge"
            ]
        },
        "lisaTransactionTypeType": {
            "type": "string",
            "enum": [
                "deposit",
                "withdrawal",
                "HTBtransfer",
                "LISAtransfer",
                "bonusClaim",
                "chargeMade"
            ]
        },
        "complianceReasonType": {
            "type": "string",
            "enum": [
                "house-purchase",
                "over-sixty",
                "chargeable",
                "terminal-illness",
                "death"
            ]
        },
        "chargeReasonCodeType": {
            "type": "string",
            "enum": [
                "over-lisa-limit",
                "outside-age-range",
                "chargeable-withdrawal"
            ]
        },
        "supersedeReasonCodeType": {
            "type": "string",
            "enum": [
                "error-correction",
                "TBD"
            ]
        }
    }
}