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