{
    "type": "object",
    "properties": {
        "Type": {
            "type": "string"
        },
        "InvoiceID": {
            "type": "string"
        },
        "InvoiceNumber": {
            "type": "string"
        },
        "Reference": {
            "type": "string"
        },
        "AmountPaid": {
            "type": "integer"
        },
        "SentToContact": {
            "type": "boolean"
        },
        "CurrencyRate": {
            "type": "integer"
        },
        "IsDiscounted": {
            "type": "boolean"
        },
        "HasErrors": {
            "type": "boolean"
        },
        "Contact": {
            "type": "object",
            "properties": {
                "ContactID": {
                    "type": "string"
                },
                "ContactStatus": {
                    "type": "string"
                },
                "Name": {
                    "type": "string"
                },
                "EmailAddress": {
                    "type": "string"
                },
                "Addresses": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "AddressType": {
                                "type": "string"
                            },
                            "City": {
                                "type": "string"
                            },
                            "Region": {
                                "type": "string"
                            },
                            "PostalCode": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "AddressType"
                        ]
                    }
                },
                "Phones": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "PhoneType": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "PhoneType"
                        ]
                    }
                },
                "UpdatedDateUTC": {
                    "type": "string"
                },
                "ContactGroups": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "ContactGroupID": {
                                "type": "string"
                            },
                            "Name": {
                                "type": "string"
                            },
                            "Status": {
                                "type": "string"
                            },
                            "HasValidationErrors": {
                                "type": "boolean"
                            }
                        },
                        "required": [
                            "ContactGroupID",
                            "Name",
                            "Status",
                            "Contacts",
                            "HasValidationErrors"
                        ]
                    }
                },
                "IsSupplier": {
                    "type": "boolean"
                },
                "IsCustomer": {
                    "type": "boolean"
                },
                "ContactPersons": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "FirstName": {
                                "type": "string"
                            },
                            "LastName": {
                                "type": "string"
                            },
                            "EmailAddress": {
                                "type": "string"
                            },
                            "IncludeInEmails": {
                                "type": "boolean"
                            }
                        },
                        "required": [
                            "FirstName",
                            "LastName",
                            "EmailAddress",
                            "IncludeInEmails"
                        ]
                    }
                },
                "HasValidationErrors": {
                    "type": "boolean"
                }
            },
            "required": [
                "ContactID",
                "ContactStatus",
                "Name",
                "Addresses",
                "Phones",
                "UpdatedDateUTC",
                "ContactGroups",
                "IsSupplier",
                "IsCustomer",
                "SalesTrackingCategories",
                "PurchasesTrackingCategories",
                "ContactPersons",
                "HasValidationErrors"
            ]
        },
        "DateString": {
            "type": "string"
        },
        "Date": {
            "type": "string"
        },
        "BrandingThemeID": {
            "type": "string"
        },
        "Status": {
            "type": "string"
        },
        "LineAmountTypes": {
            "type": "string"
        },
        "LineItems": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "ItemCode": {
                        "type": "string"
                    },
                    "Description": {
                        "type": "string"
                    },
                    "TaxType": {
                        "type": "string"
                    },
                    "AccountCode": {
                        "type": "string"
                    },
                    "Item": {
                        "type": "object",
                        "properties": {
                            "ItemID": {
                                "type": "string"
                            },
                            "Name": {
                                "type": "string"
                            },
                            "Code": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "ItemID",
                            "Code"
                        ]
                    },
                    "LineItemID": {
                        "type": "string"
                    },
                    "AccountID": {
                        "type": "string"
                    }
                },
                "required": [
                    "Tracking",
                    "LineItemID",
                    "ValidationErrors"
                ]
            }
        },
        "UpdatedDateUTC": {
            "type": "string"
        },
        "CurrencyCode": {
            "type": "string"
        }
    },
    "required": [
        "Type",
        "InvoiceID",
        "Reference",
        "Prepayments",
        "Overpayments",
        "AmountDue",
        "AmountPaid",
        "SentToContact",
        "CurrencyRate",
        "IsDiscounted",
        "HasErrors",
        "InvoicePaymentServices",
        "Contact",
        "DateString",
        "Date",
        "Status",
        "LineAmountTypes",
        "LineItems",
        "SubTotal",
        "TotalTax",
        "Total",
        "UpdatedDateUTC",
        "CurrencyCode"
    ],
    "version": 1
}
