{
    "type": "object",
    "properties": {
        "Type": {
            "type": "string"
        },
        "InvoiceID": {
            "type": "string"
        },
        "InvoiceNumber": {
            "type": "string"
        },
        "Reference": {
            "type": "string"
        },
        "Overpayments": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "OverpaymentID": {
                        "type": "string"
                    },
                    "CurrencyRate": {
                        "type": "integer"
                    },
                    "AppliedAmount": {
                        "type": "number"
                    },
                    "DateString": {
                        "type": "string"
                    },
                    "Date": {
                        "type": "string"
                    },
                    "Total": {
                        "type": "number"
                    }
                },
                "required": [
                    "OverpaymentID",
                    "CurrencyRate",
                    "AppliedAmount",
                    "DateString",
                    "Date",
                    "LineItems",
                    "Total"
                ]
            }
        },
        "SentToContact": {
            "type": "boolean"
        },
        "IsDiscounted": {
            "type": "boolean"
        },
        "HasAttachments": {
            "type": "boolean"
        },
        "HasErrors": {
            "type": "boolean"
        },
        "Attachments": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "AttachmentID": {
                        "type": "string"
                    },
                    "FileName": {
                        "type": "string"
                    },
                    "Url": {
                        "type": "string"
                    },
                    "MimeType": {
                        "type": "string"
                    },
                    "ContentLength": {
                        "type": "integer"
                    }
                },
                "required": [
                    "AttachmentID",
                    "FileName",
                    "Url",
                    "MimeType",
                    "ContentLength"
                ]
            }
        },
        "Contact": {
            "type": "object",
            "properties": {
                "ContactID": {
                    "type": "string"
                },
                "ContactStatus": {
                    "type": "string"
                },
                "Name": {
                    "type": "string"
                },
                "EmailAddress": {
                    "type": "string"
                },
                "BankAccountDetails": {
                    "type": "string"
                },
                "Addresses": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "AddressType": {
                                "type": "string"
                            },
                            "City": {
                                "type": "string"
                            },
                            "Region": {
                                "type": "string"
                            },
                            "PostalCode": {
                                "type": "string"
                            },
                            "Country": {
                                "type": "string"
                            },
                            "AddressLine1": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "AddressType"
                        ]
                    }
                },
                "Phones": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "PhoneType": {
                                "type": "string"
                            },
                            "PhoneNumber": {
                                "type": "string"
                            },
                            "PhoneAreaCode": {
                                "type": "string"
                            },
                            "PhoneCountryCode": {
                                "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"
                },
                "DefaultCurrency": {
                    "type": "string"
                },
                "SalesTrackingCategories": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "TrackingCategoryName": {
                                "type": "string"
                            },
                            "TrackingOptionName": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "TrackingCategoryName",
                            "TrackingOptionName"
                        ]
                    }
                },
                "PurchasesTrackingCategories": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "TrackingCategoryName": {
                                "type": "string"
                            },
                            "TrackingOptionName": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "TrackingCategoryName",
                            "TrackingOptionName"
                        ]
                    }
                },
                "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"
                },
                "FirstName": {
                    "type": "string"
                },
                "LastName": {
                    "type": "string"
                },
                "AccountsReceivableTaxType": {
                    "type": "string"
                }
            },
            "required": [
                "ContactID",
                "ContactStatus",
                "Name",
                "Addresses",
                "Phones",
                "UpdatedDateUTC",
                "ContactGroups",
                "IsSupplier",
                "IsCustomer",
                "SalesTrackingCategories",
                "PurchasesTrackingCategories",
                "ContactPersons",
                "HasValidationErrors"
            ]
        },
        "DateString": {
            "type": "string"
        },
        "Date": {
            "type": "string"
        },
        "DueDateString": {
            "type": "string"
        },
        "DueDate": {
            "type": "string"
        },
        "Status": {
            "type": "string"
        },
        "LineAmountTypes": {
            "type": "string"
        },
        "LineItems": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "TaxType": {
                        "type": "string"
                    },
                    "AccountCode": {
                        "type": "string"
                    },
                    "Tracking": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "Name": {
                                    "type": "string"
                                },
                                "Option": {
                                    "type": "string"
                                },
                                "TrackingCategoryID": {
                                    "type": "string"
                                },
                                "TrackingOptionID": {
                                    "type": "string"
                                }
                            },
                            "required": [
                                "Name",
                                "Option",
                                "TrackingCategoryID",
                                "TrackingOptionID"
                            ]
                        }
                    },
                    "LineItemID": {
                        "type": "string"
                    },
                    "AccountID": {
                        "type": "string"
                    },
                    "Description": {
                        "type": "string"
                    },
                    "ItemCode": {
                        "type": "string"
                    },
                    "Item": {
                        "type": "object",
                        "properties": {
                            "ItemID": {
                                "type": "string"
                            },
                            "Code": {
                                "type": "string"
                            },
                            "Name": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "ItemID",
                            "Code"
                        ]
                    }
                },
                "required": [
                    "Tracking",
                    "LineItemID",
                    "ValidationErrors"
                ]
            }
        },
        "UpdatedDateUTC": {
            "type": "string"
        },
        "CurrencyCode": {
            "type": "string"
        },
        "BrandingThemeID": {
            "type": "string"
        },
        "Url": {
            "type": "string"
        }
    },
    "required": [
        "Type",
        "InvoiceID",
        "InvoiceNumber",
        "Reference",
        "Prepayments",
        "Overpayments",
        "AmountDue",
        "AmountPaid",
        "SentToContact",
        "IsDiscounted",
        "HasAttachments",
        "HasErrors",
        "Attachments",
        "InvoicePaymentServices",
        "Contact",
        "DateString",
        "Date",
        "Status",
        "LineAmountTypes",
        "LineItems",
        "SubTotal",
        "TotalTax",
        "Total",
        "UpdatedDateUTC",
        "CurrencyCode"
    ],
    "version": 1
}
