{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Transaction",
    "type": "object",
    "additionalProperties": false,
    "properties": {
        "_id": {
            "type": "integer",
            "description": "A unique ID for Transaction"
        },
        "account": {
            "$ref": "#/definitions/AccountLink"
        },
        "amount": {
            "type": "number"
        },
        "category": {
            "$ref": "#/definitions/CategoryLink"
        },
        "classification1": {
            "$ref": "#/definitions/Classification1Link"
        },
        "cleared": {
            "type": "boolean"
        },
        "clearedState": {
            "type": "integer"
        },
        "date": {
            "type": "string",
            "format": "date-time"
        },
        "fiTransactionId": {
            "type": "string"
        },
        "frequency": {
            "$ref": "#/definitions/Frequency"
        },
        "investment": {
            "type": "boolean"
        },
        "investmentInfo": {
            "$ref": "#/definitions/InvestmentInfo"
        },
        "memo": {
            "type": "string"
        },
        "number": {
            "type": "string"
        },
        "payee": {
            "$ref": "#/definitions/PayeeLink"
        },
        "reconciled": {
            "type": "boolean"
        },
        "recurring": {
            "type": "boolean"
        },
        "splits": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/TransactionSplit"
            }
        },
        "state": {
            "type": "string",
            "enum": [
                "UNRECONCILED",
                "RECONCILED",
                "CLEARED",
                "VOID"
            ]
        },
        "statusFlag": {
            "type": "integer"
        },
        "transactionInfo": {
            "$ref": "#/definitions/TransactionInfo"
        },
        "transfer": {
            "type": "boolean"
        },
        "unaccepted": {
            "type": "boolean"
        },
        "void": {
            "type": "boolean"
        },
        "xferInfo": {
            "$ref": "#/definitions/XferInfo"
        }
    },
    "required": [
        "cleared",
        "investment",
        "reconciled",
        "recurring",
        "transfer",
        "unaccepted",
        "void"
    ],
    "definitions": {
        "AccountLink": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "_id": {
                    "type": "integer",
                    "description": "A unique ID for Account"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "CategoryLink": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "_id": {
                    "type": "integer",
                    "description": "A unique ID for Category"
                },
                "fullName": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "parentId": {
                    "type": "integer"
                },
                "parentName": {
                    "type": "string"
                }
            }
        },
        "Classification1Link": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "_id": {
                    "type": "integer",
                    "description": "A unique ID for Classification1"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "Frequency": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "label": {
                    "type": "string"
                },
                "recurring": {
                    "type": "boolean"
                },
                "type": {
                    "type": "integer"
                }
            },
            "required": [
                "recurring"
            ]
        },
        "InvestmentInfo": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "activity": {
                    "$ref": "#/definitions/InvestmentActivity"
                },
                "security": {
                    "$ref": "#/definitions/Security"
                },
                "transaction": {
                    "$ref": "#/definitions/InvestmentTransaction"
                }
            }
        },
        "InvestmentActivity": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "label": {
                    "type": "string"
                },
                "type": {
                    "type": "integer"
                }
            }
        },
        "Security": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "_id": {
                    "type": "integer",
                    "description": "A unique ID for Security"
                },
                "name": {
                    "type": "string"
                },
                "symbol": {
                    "type": "string"
                }
            }
        },
        "InvestmentTransaction": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "_id": {
                    "type": "integer",
                    "description": "A unique ID for InvestmentTransaction"
                },
                "price": {
                    "type": "number"
                },
                "quantity": {
                    "type": "number"
                }
            }
        },
        "PayeeLink": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "_id": {
                    "type": "integer",
                    "description": "A unique ID for Payee"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "TransactionSplit": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "parentId": {
                    "type": "integer"
                },
                "rowId": {
                    "type": "integer"
                },
                "transaction": {
                    "$ref": "#/definitions/Transaction"
                }
            }
        },
        "Transaction": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "_id": {
                    "type": "integer",
                    "description": "A unique ID for Transaction"
                },
                "account": {
                    "$ref": "#/definitions/AccountLink"
                },
                "amount": {
                    "type": "number"
                },
                "category": {
                    "$ref": "#/definitions/CategoryLink"
                },
                "classification1": {
                    "$ref": "#/definitions/Classification1Link"
                },
                "cleared": {
                    "type": "boolean"
                },
                "clearedState": {
                    "type": "integer"
                },
                "date": {
                    "type": "string",
                    "format": "date-time"
                },
                "fiTransactionId": {
                    "type": "string"
                },
                "frequency": {
                    "$ref": "#/definitions/Frequency"
                },
                "investment": {
                    "type": "boolean"
                },
                "investmentInfo": {
                    "$ref": "#/definitions/InvestmentInfo"
                },
                "memo": {
                    "type": "string"
                },
                "number": {
                    "type": "string"
                },
                "payee": {
                    "$ref": "#/definitions/PayeeLink"
                },
                "reconciled": {
                    "type": "boolean"
                },
                "recurring": {
                    "type": "boolean"
                },
                "splits": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/TransactionSplit"
                    }
                },
                "state": {
                    "type": "string",
                    "enum": [
                        "UNRECONCILED",
                        "RECONCILED",
                        "CLEARED",
                        "VOID"
                    ]
                },
                "statusFlag": {
                    "type": "integer"
                },
                "transactionInfo": {
                    "$ref": "#/definitions/TransactionInfo"
                },
                "transfer": {
                    "type": "boolean"
                },
                "unaccepted": {
                    "type": "boolean"
                },
                "void": {
                    "type": "boolean"
                },
                "xferInfo": {
                    "$ref": "#/definitions/XferInfo"
                }
            },
            "required": [
                "cleared",
                "investment",
                "reconciled",
                "recurring",
                "transfer",
                "unaccepted",
                "void"
            ]
        },
        "TransactionInfo": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "flag": {
                    "type": "integer"
                },
                "investment": {
                    "type": "boolean"
                },
                "splitChild": {
                    "type": "boolean"
                },
                "splitParent": {
                    "type": "boolean"
                },
                "transfer": {
                    "type": "boolean"
                },
                "transferTo": {
                    "type": "boolean"
                },
                "void": {
                    "type": "boolean"
                }
            },
            "required": [
                "investment",
                "splitChild",
                "splitParent",
                "transfer",
                "transferTo",
                "void"
            ]
        },
        "XferInfo": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "xferAccountId": {
                    "type": "integer"
                },
                "xferTransactionId": {
                    "type": "integer"
                }
            }
        }
    }
}