{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://api.greeninvoice.co.il/schema/v1",
  "$defs": {
    "getDocumentResponse": {
      "$ref": "#/$defs/Document"
    },
    "searchDocumentsRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "page": {
          "type": "number",
          "description": "Page requested"
        },
        "pageSize": {
          "type": "number",
          "description": "Results per page"
        },
        "number": {
          "$ref": "#/$defs/DocumentTaxNumber"
        },
        "type": {
          "type": "array",
          "description": "Document type",
          "items": {
            "$ref": "#/$defs/DocumentType"
          }
        },
        "status": {
          "type": "array",
          "description": "Document status",
          "items": {
            "type": "number",
            "enum": [0, 1, 2, 3, 4]
          }
        },
        "paymentTypes": {
          "type": "array",
          "description": "Payment types used in this document",
          "items": {
            "type": "number",
            "enum": [-1, 0, 1, 2, 3, 4, 5, 10, 11]
          }
        },
        "fromDate": {
          "type": "string",
          "description": "Documents that were created after the specified date in the format YYYY-MM-DD",
          "format": "date"
        },
        "toDate": {
          "type": "string",
          "description": "Documents that were created until the specified date in the format YYYY-MM-DD",
          "format": "date"
        },
        "clientId": {
          "type": "string",
          "description": "Client ID"
        },
        "clientName": {
          "type": "string",
          "description": "Client name"
        },
        "description": {
          "type": "string",
          "description": "Document description"
        },
        "download": {
          "type": "boolean",
          "description": "Whether document was downloaded by client"
        },
        "sort": {
          "enum": ["documentDate", "creationDate"]
        }
      },
      "required": []
    },
    "searchDocumentsResponse": {
      "allOf": [
        { "$ref": "#/$defs/PaginationMeta" },
        {
          "type": "object",
          "properties": {
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/Document"
              }
            }
          },
          "required": ["items"]
        }
      ],
      "unevaluatedProperties": false
    },
    "previewDocumentRequest": {
      "description": "Previews a document before the actual generation",
      "additionalProperties": false,
      "$ref": "#/$defs/DocumentInputNew"
    },
    "previewDocumentResponse": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "file": {
              "description": "Preview document file in Base64",
              "type": "string"
            }
          },
          "required": ["file"]
        },
        {
          "$ref": "#/$defs/ErrorResponse"
        }
      ]
    },
    "getLinkedDocumentsResponse": {
      "$ref": "#/$defs/GetLinkedDocuments"
    },
    "getDocumentsDownloadLinksResponse": {
      "$ref": "#/$defs/Url"
    },
    "addDocumentRequest": {
      "description": "Add a document to the current business",
      "allOf": [
        { "$ref": "#/$defs/DocumentInputNew" },
        {
          "type": "object",
          "properties": {
            "emailContent": {
              "type": "string",
              "description": "Email content to send with the document"
            },
            "attachment": {
              "type": "boolean",
              "description": "Whether to attach the document to the email"
            }
          }
        }
      ],
      "unevaluatedProperties": false
    },
    "addDocumentResponse": {
      "oneOf": [
        {
          "$ref": "#/$defs/AddedDocument"
        },
        {
          "$ref": "#/$defs/ErrorResponse"
        }
      ]
    },
    "closeDocumentResponse": {
      "type": "object",
      "additionalProperties": false,
      "properties": {}
    },
    "getExpenseRequest": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id"],
      "properties": {
        "id": {
          "type": "string",
          "description": "The expense ID"
        }
      }
    },
    "getExpenseResponse": {
      "$ref": "#/$defs/GetExpense"
    },
    "searchExpensesRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "fromDate": {
          "type": "string",
          "description": "Expense that were created after the specified date in the format YYYY-MM-DD"
        },
        "toDate": {
          "type": "string",
          "description": "Expense that were created until the specified date in the format YYYY-MM-DD"
        },
        "dueDate": {
          "type": "string",
          "description": "Due date of the expense, in the format YYYY-MM-DD"
        },
        "description": {
          "type": "string",
          "description": "Expense description"
        },
        "supplierId": {
          "type": "string",
          "description": "Supplier's ID"
        },
        "supplierName": {
          "type": "string",
          "description": "Supplier's name"
        },
        "number": {
          "type": "string",
          "description": "Expense serial number"
        },
        "paid": {
          "type": "boolean",
          "description": "Filter expenses that are only paid or unpaid, if not added to the request, will return both"
        },
        "reported": {
          "type": "boolean",
          "description": "Filter expenses that are only reported or unreported, if not added to the request, will return both"
        },
        "sort": {
          "type": "string",
          "description": "The field to sort the results by"
        },
        "minAmount": {
          "type": "number",
          "description": "Min amount of the expense"
        },
        "maxAmount": {
          "type": "number",
          "description": "Max amount of the expense"
        },
        "page": {
          "type": "number",
          "description": "Page requested"
        },
        "pageSize": {
          "type": "number",
          "description": "Results per page"
        }
      },
      "required": ["minAmount", "maxAmount", "page", "pageSize"]
    },
    "searchExpensesResponse": {
      "allOf": [
        { "$ref": "#/$defs/PaginationMeta" },
        {
          "type": "object",
          "properties": {
            "items": {
              "$ref": "#/$defs/GetExpense"
            }
          }
        }
      ],
      "unevaluatedProperties": false
    },
    "addExpenseRequest": {
      "$ref": "#/$defs/Expense"
    },
    "addExpenseResponse": {
      "oneOf": [
        {
          "$ref": "#/$defs/Expense"
        },
        {
          "$ref": "#/$defs/ErrorResponse"
        }
      ]
    },
    "updateExpenseRequest": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id"],
      "properties": {
        "id": {
          "type": "string",
          "description": "The expense ID"
        },
        "paymentType": {
          "description": "Payment method",
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": ["string", "number"],
              "enum": ["1", "2", "3", "4", "5", "10", "11", 1, 2, 3, 4, 5, 10, 11]
            }
          ]
        },
        "currency": {
          "$ref": "#/$defs/Currency"
        },
        "currencyRate": {
          "$ref": "#/$defs/CurrencyRate"
        },
        "vat": {
          "$ref": "#/$defs/Vat"
        },
        "amount": {
          "type": "number",
          "description": "The total amount of the expense"
        },
        "date": {
          "type": "string",
          "description": "Date of the expense"
        },
        "dueDate": {
          "type": "string",
          "description": "Due date of the expense"
        },
        "reportingDate": {
          "type": "string",
          "description": "Reporting date of the expense"
        },
        "documentType": {
          "$ref": "#/$defs/ExpenseDocumentType"
        },
        "number": {
          "type": "string",
          "description": "Number of the expense"
        },
        "description": {
          "type": "string",
          "description": "Description for the expense"
        },
        "remarks": {
          "type": "string",
          "description": "Remarks for the expense"
        },
        "supplier": {
          "$ref": "#/$defs/Supplier"
        },
        "accountingClassification": {
          "$ref": "#/$defs/AccountingClassification"
        },
        "active": {
          "type": "boolean",
          "description": "Is the expense active or not"
        }
      }
    },
    "updateExpenseResponse": {
      "oneOf": [
        {
          "$ref": "#/$defs/GetExpense"
        },
        {
          "$ref": "#/$defs/ErrorResponse"
        }
      ]
    },
    "searchExpenseDraftsRequest": {
      "type": "object",
      "additionalProperties": false,
      "required": [],
      "properties": {
        "fromDate": {
          "type": "string",
          "description": "Expense drafts that were created after the specified date in the format YYYY-MM-DD",
          "format": "date"
        },
        "toDate": {
          "type": "string",
          "description": "Expense drafts that were created until the specified date in the format YYYY-MM-DD",
          "format": "date"
        },
        "description": {
          "type": "string",
          "description": "Expense draft description"
        },
        "supplierId": {
          "type": "string",
          "description": "Supplier's ID"
        },
        "supplierName": {
          "type": "string",
          "description": "Supplier's name"
        },
        "page": {
          "type": "number",
          "description": "Page requested"
        },
        "pageSize": {
          "type": "number",
          "description": "Results per page"
        }
      }
    },
    "searchExpenseDraftsResponse": {
      "allOf": [
        { "$ref": "#/$defs/PaginationMeta" },
        {
          "type": "object",
          "properties": {
            "aggregations": {
              "type": "object",
              "additionalProperties": false,
              "required": ["totalAmount"],
              "properties": {
                "totalAmount": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": ["value"],
                  "properties": {
                    "value": {
                      "type": "number"
                    }
                  }
                }
              }
            },
            "items": {
              "type": "array",
              "description": "The expense drafts that were found",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "description": "Partial Expense",
                "required": [
                  "id",
                  "status",
                  "creationDate",
                  "lastUpdateDate",
                  "reportingPeriod",
                  "hasDefaultValues",
                  "url",
                  "thumbnail",
                  "expense"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "status": {
                    "type": "number"
                  },
                  "creationDate": {
                    "$ref": "#/$defs/CreationDate"
                  },
                  "lastUpdateDate": {
                    "type": "number"
                  },
                  "reportingPeriod": {
                    "type": "string"
                  },
                  "hasDefaultValues": {
                    "type": "boolean"
                  },
                  "url": {
                    "type": "string"
                  },
                  "thumbnail": {
                    "type": "string"
                  },
                  "expense": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "accountingClassification",
                      "active",
                      "addRecipient",
                      "confirmFromEdit",
                      "currency",
                      "currencyRate",
                      "description",
                      "documentType",
                      "fileHash",
                      "fileKey",
                      "labels",
                      "reportingDate",
                      "supplier",
                      "tags",
                      "texts",
                      "vat"
                    ],
                    "properties": {
                      "accountingClassification": {
                        "$ref": "#/$defs/AccountingClassification"
                      },
                      "active": {
                        "type": "boolean",
                        "description": "Is the expense active or not"
                      },
                      "addRecipient": {
                        "type": "boolean",
                        "description": "Should we save the supplier or not (by setting this to true you are required to add a supplier)"
                      },
                      "amount": {
                        "type": "number",
                        "description": "The total amount of the expense"
                      },
                      "confirmFromEdit": {
                        "type": "boolean"
                      },
                      "currency": {
                        "$ref": "#/$defs/Currency"
                      },
                      "currencyRate": {
                        "$ref": "#/$defs/CurrencyRate"
                      },
                      "date": {
                        "type": "string",
                        "description": "Date of the expense"
                      },
                      "description": {
                        "type": "string",
                        "description": "Description for the expense"
                      },
                      "documentType": {
                        "$ref": "#/$defs/ExpenseDocumentType"
                      },
                      "fileHash": {
                        "type": "string",
                        "description": "File hash"
                      },
                      "fileKey": {
                        "type": "string",
                        "description": "Key of the file location"
                      },
                      "labels": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "number": {
                        "type": ["string", "null"],
                        "description": "Number of the expense"
                      },
                      "paymentType": {
                        "description": "Payment method",
                        "oneOf": [
                          {
                            "type": "boolean"
                          },
                          {
                            "type": ["string", "number"],
                            "enum": ["1", "2", "3", "4", "5", "10", "11", 1, 2, 3, 4, 5, 10, 11]
                          }
                        ]
                      },
                      "reportingDate": {
                        "type": "string",
                        "description": "Reporting date of the expense"
                      },
                      "supplier": {
                        "$ref": "#/$defs/Supplier"
                      },
                      "tags": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "texts": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "vat": {
                        "$ref": "#/$defs/Vat"
                      }
                    }
                  }
                }
              }
            }
          },
          "required": ["aggregations", "items"]
        }
      ],
      "unevaluatedProperties": false
    },
    "addExpenseDraftByFileRequest": {
      "type": "object",
      "additionalProperties": false,
      "required": [],
      "properties": {
        "file": {
          "type": "string",
          "description": "The file, in Base64, allowed types: GIF, PNG, JPG, SVG, PDF"
        }
      }
    },
    "addExpenseDraftByFileResponse": {
      "$ref": "#/$defs/GetExpenseDraft"
    },
    "addClientRequest": {
      "description": "Add a new client to the current business",
      "allOf": [
        { "$ref": "#/$defs/ContactInfo" },
        { "$ref": "#/$defs/Address" },
        { "$ref": "#/$defs/BankingInfo" },
        {
          "type": "object",
          "properties": {
            "name": {
              "$ref": "#/$defs/ClientName"
            },
            "active": {
              "type": "boolean",
              "description": "Is the client currently active or not"
            },
            "taxId": {
              "type": "string",
              "description": "The client tax ID",
              "examples": ["0123456789"]
            },
            "paymentTerms": {
              "type": "integer",
              "description": "The client payment term, default is 0",
              "enum": [-1, 0, 10, 15, 30, 45, 60, 75, 90, 120]
            },
            "labels": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "send": {
              "type": "boolean",
              "description": "Whether to send emails to the user automatically when assigning him to an invoice or not"
            },
            "department": {
              "type": "string",
              "description": "The client department"
            },
            "accountingKey": {
              "type": "string",
              "description": "The client accounting key"
            },
            "category": {
              "type": "integer",
              "description": "The category this client is related to"
            },
            "subCategory": {
              "type": "integer",
              "description": "The sub category this client is related to"
            },
            "remarks": {
              "type": "string",
              "description": "Client remarks for self use",
              "example": "Customer approved 2016 sales"
            }
          },
          "required": ["name"]
        }
      ],
      "unevaluatedProperties": false
    },
    "addClientResponse": {
      "oneOf": [
        {
          "$ref": "#/$defs/getClientResponse"
        },
        {
          "$ref": "#/$defs/ErrorResponse"
        }
      ]
    },
    "updateClientRequest": {
      "description": "Update an existing client",
      "type": "object",
      "additionalProperties": false,
      "required": ["name"],
      "properties": {
        "name": {
          "$ref": "#/$defs/ClientName"
        },
        "active": {
          "type": "boolean",
          "description": "Is the client currently active or not"
        },
        "taxId": {
          "type": "string",
          "description": "The client tax ID",
          "examples": ["0123456789"]
        },
        "paymentTerms": {
          "type": "integer",
          "description": "The client payment term, default is 0",
          "enum": [-1, 0, 10, 15, 30, 45, 60, 75, 90, 120]
        },
        "labels": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "send": {
          "type": "boolean",
          "description": "Whether to send emails to the user automatically when assigning him to an invoice or not"
        },
        "department": {
          "type": "string",
          "description": "The client department"
        },
        "accountingKey": {
          "type": "string",
          "description": "The client accounting key"
        },
        "category": {
          "type": "integer",
          "description": "The category this client is related to"
        },
        "subCategory": {
          "type": "integer",
          "description": "The sub category this client is related to"
        },
        "remarks": {
          "type": "string",
          "description": "Client remarks for self use",
          "example": "Customer approved 2016 sales"
        },
        "phone": {
          "type": "string",
          "description": "Phone number"
        },
        "mobile": {
          "type": "string",
          "description": "Mobile number"
        },
        "emails": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "email"
          },
          "description": "Email addresses"
        },
        "fax": {
          "type": "string",
          "description": "Fax number"
        },
        "contactPerson": {
          "type": "string",
          "description": "Contact person name"
        },
        "address": {
          "type": "string",
          "description": "Street address"
        },
        "city": {
          "type": "string",
          "description": "City name"
        },
        "zip": {
          "type": "string",
          "description": "Zip/postal code"
        },
        "country": {
          "$ref": "#/$defs/Country"
        },
        "bankName": {
          "type": "string",
          "description": "Bank name"
        },
        "bankBranch": {
          "type": "string",
          "description": "Bank branch number"
        },
        "bankAccount": {
          "type": "string",
          "description": "Bank account number"
        }
      }
    },
    "updateClientResponse": {
      "oneOf": [
        {
          "$ref": "#/$defs/getClientResponse"
        },
        {
          "$ref": "#/$defs/ErrorResponse"
        }
      ]
    },
    "deleteClientResponse": {
      "oneOf": [
        {
          "$ref": "#/$defs/getClientResponse"
        },
        {
          "$ref": "#/$defs/ErrorResponse"
        }
      ]
    },
    "getClientResponse": {
      "allOf": [
        { "$ref": "#/$defs/ContactInfo" },
        { "$ref": "#/$defs/Address" },
        { "$ref": "#/$defs/BankingInfo" },
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/ClientId"
            },
            "name": {
              "$ref": "#/$defs/ClientName"
            },
            "active": {
              "type": "boolean",
              "description": "Is the client currently active or not"
            },
            "taxId": {
              "type": "string",
              "description": "The client tax ID",
              "examples": ["0123456789"]
            },
            "paymentTerms": {
              "type": "integer",
              "description": "The client payment term, default is 0",
              "enum": [-1, 0, 10, 15, 30, 45, 60, 75, 90, 120]
            },
            "labels": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "creationDate": {
              "$ref": "#/$defs/CreationDate"
            },
            "lastUpdateDate": {
              "type": "integer",
              "description": "The last update date of the supplier, in UNIX timestamp format"
            },
            "send": {
              "type": "boolean",
              "description": "Whether to send emails to the user automatically when assigning him to an invoice or not"
            },
            "department": {
              "type": "string",
              "description": "The supplier department"
            },
            "accountingKey": {
              "type": "string",
              "description": "The supplier accounting key"
            },
            "category": {
              "type": "integer",
              "description": "The category this client is related to"
            },
            "subCategory": {
              "type": "integer",
              "description": "The sub category this client is related to"
            },
            "remarks": {
              "type": "string",
              "description": "Client remarks for self use",
              "example": "Customer approved 2016 sales"
            },
            "incomeAmount": {
              "type": "number",
              "description": "The amount of incomes from the customer"
            },
            "paymentAmount": {
              "type": "number"
            },
            "balanceAmount": {
              "type": "number",
              "description": "The balance amount of the client"
            }
          }
        }
      ],
      "unevaluatedProperties": false
    },

    "getFileUploadUrlResponse": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "description": "File Upload URL"
        },
        "fields": {
          "type": "object",
          "properties": {
            "otherField": {
              "type": "string"
            },
            "bucket": {
              "type": "string"
            },
            "key": {
              "type": "string"
            },
            "Policy": {
              "type": "string"
            },
            "x-amz-meta-account-id": {
              "type": "string"
            },
            "x-amz-meta-user-id": {
              "type": "string"
            },
            "x-amz-meta-business-id": {
              "type": "string"
            },
            "x-amz-meta-file-context": {
              "type": "string"
            },
            "x-amz-meta-file-data": {
              "type": "string"
            },
            "X-Amz-Algorithm": {
              "type": "string"
            },
            "X-Amz-Credential": {
              "type": "string"
            },
            "X-Amz-Date": {
              "type": "string"
            },
            "X-Amz-Security-Token": {
              "type": "string"
            },
            "X-Amz-Signature": {
              "type": "string"
            }
          }
        }
      },
      "required": ["url", "fields"]
    },
    "getBankTransactionsResponse": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "size": {
          "type": "integer"
        },
        "total": {
          "type": "integer"
        },
        "pages": {
          "type": "integer"
        },
        "page": {
          "type": "integer"
        },
        "from": {
          "type": "integer"
        },
        "to": {
          "type": "integer"
        },
        "aggregations": {
          "type": "object",
          "additionalProperties": false
        },
        "results": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BankTransaction"
          }
        }
      },
      "required": []
    },
    "generalErrorResponse": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "errorCode": {
          "type": "integer"
        },
        "errorMessage": {
          "type": ["string", "null"]
        }
      }
    },
    "AccountingClassification": {
      "type": "object",
      "additionalProperties": false,
      "description": "Account classification of the expense",
      "properties": {
        "id": {
          "type": "string",
          "description": "The classification ID, see 'Get Accounting Classifications' endpoint"
        },
        "key": {
          "type": "string",
          "description": "The classification key"
        },
        "code": {
          "type": "string",
          "description": "The classification code"
        },
        "title": {
          "type": "string",
          "description": "The classification title"
        },
        "irsCode": {
          "type": "number",
          "description": "The classification IRS code",
          "enum": [
            1306, 1307, 1310, 1320, 1330, 1340, 1390, 3011, 3012, 3015, 3055, 3060, 3066, 3067,
            3068, 3070, 3075, 3080, 3085, 3090, 3100, 3120, 3511, 3512, 3515, 3520, 3535, 3540,
            3545, 3550, 3555, 3560, 3566, 3567, 3568, 3570, 3575, 3580, 3590, 3595, 3600, 3620,
            3625, 3640, 3650, 3660, 3665, 3680, 5010, 5090, 8040, 8050, 8060, 8080, 8090
          ]
        },
        "income": {
          "type": "number",
          "description": "The classification income"
        },
        "type": {
          "type": "number",
          "description": "The classification type"
        },
        "vat": {
          "type": "number",
          "description": "The classification VAT"
        }
      }
    },
    "Address": {
      "type": "object",
      "description": "Physical address information",
      "additionalProperties": false,
      "properties": {
        "address": {
          "type": "string",
          "description": "Street address"
        },
        "city": {
          "type": "string",
          "description": "City name"
        },
        "zip": {
          "type": "string",
          "description": "Zip/postal code"
        },
        "country": {
          "$ref": "#/$defs/Country"
        }
      }
    },
    "BankingInfo": {
      "type": "object",
      "description": "Banking information",
      "additionalProperties": false,
      "properties": {
        "bankName": {
          "type": "string",
          "description": "Bank name"
        },
        "bankBranch": {
          "type": "string",
          "description": "Bank branch number"
        },
        "bankAccount": {
          "type": "string",
          "description": "Bank account number"
        }
      }
    },
    "BankTransaction": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "The transaction ID"
        },
        "aspspCode": {
          "type": "string",
          "description": "The bank code",
          "enum": ["12"]
        },
        "businessId": {
          "type": "string",
          "description": "The business ID"
        },
        "createdAt": {
          "type": "number",
          "description": "The creation date timestamp"
        },
        "updatedAt": {
          "type": "number",
          "description": "The update date timestamp"
        },
        "status": {
          "type": "integer"
        },
        "classification": {
          "type": "integer"
        },
        "bookingStatus": {
          "type": "string",
          "description": "The booking status",
          "enum": ["booked"]
        },
        "source": {
          "type": "string",
          "description": "The source of the transaction",
          "enum": ["bank"]
        },
        "amount": {
          "type": "number",
          "description": "The amount of the transaction"
        },
        "resourceId": {
          "type": "string",
          "description": "The resource ID"
        },
        "creditorName": {
          "type": ["string", "null"],
          "description": "The creditor name"
        },
        "creditorAccount": {
          "type": ["string", "null"],
          "description": "The creditor account"
        },
        "currency": { "$ref": "#/$defs/Currency" },
        "valueDate": {
          "type": "string",
          "description": "Value date of the transaction"
        },
        "bookingDate": {
          "type": "string",
          "description": "Booking date of the transaction"
        },
        "checkId": {
          "type": ["string", "null"],
          "description": "The check ID"
        },
        "description": {
          "type": "string"
        },
        "debtorName": {
          "type": ["string", "null"],
          "description": "The debtor name"
        },
        "debtorAccount": {
          "type": ["string", "null"],
          "description": "The debtor account"
        },
        "type": {
          "type": "string",
          "description": "The type of the transaction",
          "enum": ["credit", "debt"]
        },
        "name": { "type": "string" },
        "date": {
          "type": "string"
        },
        "iban": {
          "type": "string",
          "description": "The IBAN of the transaction"
        }
      }
    },
    "Business": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "accountantDocsEmailSettings": {
          "type": "number"
        },
        "accountantEmails": {
          "type": "array"
        },
        "accountantReportEmailSettings": {
          "type": "number"
        },
        "accountingType": {
          "type": "number"
        },
        "active": {
          "type": "boolean"
        },
        "advanceNationalInsuranceRate": {
          "type": "number"
        },
        "advanceTaxRate": {
          "type": "number"
        },
        "bankDisplay": {
          "type": "boolean"
        },
        "bankDisplayEn": {
          "type": "boolean"
        },
        "deductionRate": {
          "type": "number"
        },
        "documentsEmailSettings": {
          "type": "number"
        },
        "emailSubjectType": {
          "type": "number"
        },
        "exemption": {
          "type": "boolean",
          "description": "Is the business exemption free or not",
          "examples": [false]
        },
        "incomeReportEmailSettings": {
          "type": "number"
        },
        "incomeReportFormatType": {
          "type": "number"
        },
        "reportSendingDay": {
          "type": "number"
        },
        "senderEmailSettings": {
          "type": "number"
        },
        "type": {
          "type": "number",
          "description": "The business type ID",
          "enum": [1, 2, 3, 4, 5, 6]
        }
      },
      "required": [
        "accountantDocsEmailSettings",
        "accountantEmails",
        "accountantReportEmailSettings",
        "accountingType",
        "active",
        "advanceNationalInsuranceRate",
        "advanceTaxRate",
        "bankDisplay",
        "bankDisplayEn",
        "deductionRate",
        "documentsEmailSettings",
        "emailSubjectType",
        "exemption",
        "incomeReportEmailSettings",
        "incomeReportFormatType",
        "reportSendingDay",
        "senderEmailSettings",
        "type"
      ]
    },
    "Client": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "country": {
          "$ref": "#/$defs/Country"
        },
        "emails": {
          "$ref": "#/$defs/ClientEmails"
        },
        "id": {
          "$ref": "#/$defs/ClientId"
        },
        "name": {
          "$ref": "#/$defs/ClientName"
        },
        "phone": {
          "$ref": "#/$defs/ClientPhone"
        },
        "taxId": {
          "type": "string",
          "description": "The client tax ID",
          "examples": ["0123456789"]
        },
        "self": {
          "$ref": "#/$defs/ClientSelf"
        },
        "address": {
          "type": "string",
          "description": "Client address"
        },
        "city": {
          "type": "string",
          "description": "Client city"
        },
        "zip": {
          "type": "string",
          "description": "Client zip code"
        },
        "fax": {
          "type": "string",
          "description": "Client fax"
        },
        "mobile": {
          "type": "string",
          "description": "The client mobile number"
        },
        "add": {
          "type": "boolean",
          "description": "Add a temporary client to the clients' list"
        }
      }
    },
    "ClientEmails": {
      "type": "array",
      "description": "List of email addresses",
      "items": {
        "type": "string",
        "format": "email"
      }
    },
    "ClientId": {
      "type": "string",
      "description": "The client ID",
      "examples": ["8b338c95-095e-46d4-b2c6-331747508759"],
      "format": "uuid"
    },
    "ClientName": {
      "type": "string",
      "description": "The client name",
      "examples": ["לקוח אפ3"],
      "minLength": 1
    },
    "ClientPhone": {
      "type": "string"
    },
    "ClientSelf": {
      "type": "boolean",
      "description": "Whether the client is self",
      "examples": [false]
    },
    "ContactInfo": {
      "type": "object",
      "description": "Contact information for clients and suppliers",
      "additionalProperties": false,
      "properties": {
        "phone": {
          "type": "string",
          "description": "Phone number"
        },
        "mobile": {
          "type": "string",
          "description": "Mobile number"
        },
        "emails": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "email"
          },
          "description": "Email addresses"
        },
        "fax": {
          "type": "string",
          "description": "Fax number"
        },
        "contactPerson": {
          "type": "string",
          "description": "Contact person name"
        }
      }
    },
    "Country": {
      "type": "string",
      "description": "2-letter ISO supplier country code, default is IL",
      "enum": [
        "UG",
        "UZ",
        "AT",
        "AU",
        "UA",
        "UY",
        "AZ",
        "CX",
        "AE",
        "IT",
        "BS",
        "GS",
        "UM",
        "VI",
        "VG",
        "HM",
        "TC",
        "MP",
        "MH",
        "SB",
        "FO",
        "FK",
        "FJ",
        "KM",
        "CK",
        "CC",
        "KY",
        "ID",
        "IS",
        "IE",
        "IR",
        "SV",
        "AL",
        "DZ",
        "AX",
        "AO",
        "AI",
        "AD",
        "AQ",
        "AG",
        "EE",
        "AF",
        "EC",
        "AR",
        "US",
        "AW",
        "ER",
        "AM",
        "ET",
        "BT",
        "BV",
        "BW",
        "BG",
        "BO",
        "BA",
        "BI",
        "BF",
        "BH",
        "BY",
        "BE",
        "BZ",
        "BD",
        "BJ",
        "BB",
        "BN",
        "BR",
        "GB",
        "BM",
        "DJ",
        "JM",
        "JE",
        "GA",
        "GE",
        "GH",
        "GT",
        "GU",
        "GP",
        "GY",
        "GI",
        "GN",
        "GW",
        "GQ",
        "GF",
        "GM",
        "GL",
        "DE",
        "GD",
        "GG",
        "DM",
        "DK",
        "ZA",
        "SS",
        "KR",
        "IM",
        "NF",
        "HT",
        "MV",
        "BQ",
        "IN",
        "NL",
        "HK",
        "HU",
        "HN",
        "IO",
        "TF",
        "PH",
        "DO",
        "CD",
        "CF",
        "PS",
        "WF",
        "VN",
        "VU",
        "VE",
        "VA",
        "ZW",
        "ZM",
        "CI",
        "TJ",
        "TV",
        "TG",
        "TO",
        "TN",
        "TK",
        "TR",
        "TM",
        "TW",
        "TZ",
        "TT",
        "GR",
        "JP",
        "JO",
        "IL",
        "KW",
        "CV",
        "LA",
        "LB",
        "LY",
        "LU",
        "LV",
        "LR",
        "LT",
        "LI",
        "LS",
        "MR",
        "MU",
        "ML",
        "MG",
        "MZ",
        "MD",
        "MN",
        "ME",
        "MS",
        "MC",
        "TL",
        "MM",
        "YT",
        "FM",
        "MW",
        "MY",
        "MT",
        "EG",
        "MO",
        "MK",
        "MX",
        "MA",
        "MQ",
        "NR",
        "NO",
        "NG",
        "NZ",
        "NU",
        "NE",
        "NI",
        "NA",
        "NP",
        "ST",
        "SJ",
        "EH",
        "SD",
        "SZ",
        "SO",
        "SY",
        "SR",
        "SL",
        "SC",
        "CN",
        "SG",
        "SI",
        "SK",
        "WS",
        "AS",
        "BL",
        "MF",
        "SM",
        "PM",
        "SN",
        "SH",
        "VC",
        "LC",
        "SX",
        "KN",
        "SA",
        "ES",
        "RS",
        "LK",
        "OM",
        "IQ",
        "PW",
        "PL",
        "PF",
        "PR",
        "PT",
        "PN",
        "FI",
        "PA",
        "PG",
        "PK",
        "PY",
        "PE",
        "TD",
        "CL",
        "CZ",
        "KP",
        "FR",
        "CU",
        "CO",
        "CG",
        "XK",
        "CR",
        "CW",
        "KZ",
        "QA",
        "KG",
        "KI",
        "NC",
        "KH",
        "CM",
        "CA",
        "KE",
        "CY",
        "HR",
        "RE",
        "RW",
        "RO",
        "RU",
        "SE",
        "CH",
        "TH",
        "YE"
      ]
    },
    "Currency": {
      "type": "string",
      "description": "3-letter ISO item currency code",
      "enum": [
        "ILS",
        "USD",
        "EUR",
        "GBP",
        "JPY",
        "CHF",
        "CNY",
        "AUD",
        "CAD",
        "RUB",
        "BRL",
        "HKD",
        "SGD",
        "THB",
        "MXN",
        "TRY",
        "NZD",
        "SEK",
        "NOK",
        "DKK",
        "KRW",
        "INR",
        "IDR",
        "PLN",
        "RON",
        "ZAR",
        "HRK"
      ]
    },
    "AddedDocument": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/DocumentId"
        },
        "lang": {
          "$ref": "#/$defs/DocumentLang"
        },
        "number": {
          "$ref": "#/$defs/DocumentSerialNumber"
        },
        "signed": {
          "$ref": "#/$defs/DocumentSigned"
        },
        "url": {
          "$ref": "#/$defs/Url"
        }
      },
      "required": ["id", "lang", "number", "signed", "url"]
    },
    "Document": {
      "type": "object",
      "description": "A Single Document",
      "additionalProperties": false,
      "properties": {
        "amount": {
          "$ref": "#/$defs/DocumentAmount"
        },
        "amountDueVat": {
          "$ref": "#/$defs/DocumentAmountDueVat"
        },
        "amountDueVatLocal": {
          "$ref": "#/$defs/DocumentAmountDueVatLocal"
        },
        "amountExcludeVat": {
          "$ref": "#/$defs/DocumentAmountExcludeVat"
        },
        "amountExemptVat": {
          "$ref": "#/$defs/DocumentAmountExemptVat"
        },
        "amountLocal": {
          "$ref": "#/$defs/DocumentAmountLocal"
        },
        "amountOpened": {
          "$ref": "#/$defs/DocumentAmountOpened"
        },
        "business": {
          "$ref": "#/$defs/Business"
        },
        "calculatedAmountLocal": {
          "type": "number"
        },
        "calculatedAmountOpenedLocal": {
          "type": "number"
        },
        "calculatedIncomeAmountExcludeLocal": {
          "type": "number"
        },
        "calculatedIncomeAmountLocal": {
          "type": "number"
        },
        "calculatedPaymentAmountLocal": {
          "type": "number"
        },
        "cancellable": {
          "type": "boolean"
        },
        "cancelType": {
          "type": "number"
        },
        "client": {
          "allOf": [
            { "$ref": "#/$defs/Client" },
            {
              "type": "object",
              "required": ["country", "emails", "id", "name", "phone", "self"]
            }
          ],
          "unevaluatedProperties": false
        },
        "creationDate": {
          "$ref": "#/$defs/CreationDate"
        },
        "currency": { "$ref": "#/$defs/Currency" },
        "currencyRate": {
          "$ref": "#/$defs/CurrencyRate"
        },
        "data": {
          "$ref": "#/$defs/DocumentData"
        },
        "description": {
          "$ref": "#/$defs/DocumentDescription"
        },
        "documentDate": {
          "$ref": "#/$defs/DocumentDate"
        },
        "downloaded": {
          "type": "boolean"
        },
        "footer": {
          "$ref": "#/$defs/DocumentFooter"
        },
        "id": {
          "$ref": "#/$defs/DocumentId"
        },
        "income": {
          "$ref": "#/$defs/DocumentIncome"
        },
        "lang": {
          "$ref": "#/$defs/DocumentLang"
        },
        "linkedDocuments": {
          "$ref": "#/$defs/DocumentLinkedDocuments"
        },
        "number": {
          "$ref": "#/$defs/DocumentTaxNumber"
        },
        "payment": {
          "$ref": "#/$defs/DocumentPayment"
        },
        "ref": {
          "$ref": "#/$defs/DocumentRef"
        },
        "remarks": {
          "$ref": "#/$defs/DocumentRemarks"
        },
        "reverseCharge": {
          "type": "boolean"
        },
        "rounding": {
          "$ref": "#/$defs/DocumentRounding"
        },
        "signed": {
          "$ref": "#/$defs/DocumentSigned"
        },
        "skinId": {
          "type": "number"
        },
        "status": {
          "$ref": "#/$defs/DocumentStatus"
        },
        "taxConfirmationEligible": {
          "type": "boolean"
        },
        "templateId": {
          "type": "number"
        },
        "type": {
          "$ref": "#/$defs/DocumentType"
        },
        "url": {
          "$ref": "#/$defs/Url"
        },
        "userName": {
          "type": "string"
        },
        "vat": {
          "$ref": "#/$defs/Vat"
        },
        "vatLocal": {
          "type": "number"
        },
        "vatRate": {
          "$ref": "#/$defs/VatRate"
        },
        "vatType": {
          "$ref": "#/$defs/VatType"
        }
      },
      "required": [
        "amount",
        "amountDueVat",
        "amountDueVatLocal",
        "amountExcludeVat",
        "amountExemptVat",
        "amountLocal",
        "amountOpened",
        "business",
        "calculatedAmountLocal",
        "calculatedAmountOpenedLocal",
        "calculatedIncomeAmountExcludeLocal",
        "calculatedIncomeAmountLocal",
        "calculatedPaymentAmountLocal",
        "cancellable",
        "client",
        "creationDate",
        "currency",
        "currencyRate",
        "data",
        "description",
        "documentDate",
        "downloaded",
        "id",
        "income",
        "lang",
        "number",
        "payment",
        "ref",
        "reverseCharge",
        "rounding",
        "signed",
        "skinId",
        "status",
        "taxConfirmationEligible",
        "templateId",
        "type",
        "url",
        "vat",
        "vatRate",
        "vatType"
      ]
    },
    "DocumentInputNew": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "description": {
          "$ref": "#/$defs/DocumentDescription"
        },
        "remarks": {
          "$ref": "#/$defs/DocumentRemarks"
        },
        "footer": {
          "$ref": "#/$defs/DocumentFooter"
        },
        "type": {
          "$ref": "#/$defs/DocumentType"
        },
        "date": {
          "description": "Document date in the format YYYY-MM-DD",
          "type": "string"
        },
        "dueDate": {
          "description": "Document payment due date in the format YYYY-MM-DD",
          "type": "string"
        },
        "lang": {
          "$ref": "#/$defs/DocumentLang"
        },
        "currency": { "$ref": "#/$defs/Currency" },
        "vatType": {
          "$ref": "#/$defs/VatType"
        },
        "discount": {
          "$ref": "#/$defs/DocumentDiscount"
        },
        "rounding": {
          "$ref": "#/$defs/DocumentRounding"
        },
        "signed": {
          "$ref": "#/$defs/DocumentSigned"
        },
        "maxPayments": {
          "description": "Max payments allowed (valid only on supported accounts)",
          "type": "integer"
        },
        "client": {
          "allOf": [
            { "$ref": "#/$defs/Client" },
            {
              "type": "object",
              "required": ["id"]
            }
          ],
          "unevaluatedProperties": false
        },
        "income": {
          "$ref": "#/$defs/DocumentIncome"
        },
        "payment": {
          "$ref": "#/$defs/DocumentPayment"
        },
        "linkedDocumentIds": {
          "description": "Linked document IDs. allows you to state the related / relevant documents, e.g.: when creating a receipt, attach your original invoice document ID as one of the ids in the linkedDocumentIds - this in turn will automatically close the original invoice if needed.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "linkedPaymentId": {
          "description": "Linked payment ID (valid for document type 305 only). allows you to define the paymentId that the document is going to be relevant to, this can be attached only to invoice documents (type 305).",
          "type": "string"
        },
        "linkType": {
          "description": "Reference type (applicable only when using linkedDocumentIds)",
          "type": "string",
          "enum": ["LINK", "CANCEL"]
        }
      },
      "required": ["type", "lang", "currency", "vatType"]
    },
    "DocumentCore": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "amount": {
          "$ref": "#/$defs/DocumentAmount"
        },
        "amountDueVat": {
          "$ref": "#/$defs/DocumentAmountDueVat"
        },
        "amountExcludeVat": {
          "$ref": "#/$defs/DocumentAmountExcludeVat"
        },
        "amountExemptVat": {
          "$ref": "#/$defs/DocumentAmountExemptVat"
        },
        "amountLocal": {
          "$ref": "#/$defs/DocumentAmountLocal"
        },
        "amountOpened": {
          "$ref": "#/$defs/DocumentAmountOpened"
        },
        "business": {
          "$ref": "#/$defs/Business"
        },
        "calculatedAmountLocal": {
          "type": "number"
        },
        "calculatedAmountOpenedLocal": {
          "type": "number"
        },
        "calculatedIncomeAmountExcludeLocal": {
          "type": "number"
        },
        "calculatedIncomeAmountLocal": {
          "type": "number"
        },
        "calculatedPaymentAmountLocal": {
          "type": "number"
        },
        "cancellable": {
          "type": "boolean"
        },
        "cancelType": {
          "type": "number"
        },
        "client": {
          "$ref": "#/$defs/Client"
        },
        "creationDate": {
          "$ref": "#/$defs/CreationDate"
        },
        "currency": { "$ref": "#/$defs/Currency" },
        "currencyRate": {
          "$ref": "#/$defs/CurrencyRate"
        },
        "data": {
          "$ref": "#/$defs/DocumentData"
        },
        "description": {
          "$ref": "#/$defs/DocumentDescription"
        },
        "documentDate": {
          "$ref": "#/$defs/DocumentDate"
        },
        "downloaded": {
          "type": "boolean"
        },
        "id": {
          "$ref": "#/$defs/DocumentId"
        },
        "income": {
          "$ref": "#/$defs/DocumentIncome"
        },
        "lang": {
          "$ref": "#/$defs/DocumentLang"
        },
        "number": {
          "$ref": "#/$defs/DocumentTaxNumber"
        },
        "payment": {
          "$ref": "#/$defs/DocumentPayment"
        },
        "ref": {
          "$ref": "#/$defs/DocumentRef"
        },
        "remarks": {
          "$ref": "#/$defs/DocumentRemarks"
        },
        "reverseCharge": {
          "type": "boolean"
        },
        "rounding": {
          "$ref": "#/$defs/DocumentRounding"
        },
        "signed": {
          "$ref": "#/$defs/DocumentSigned"
        },
        "skinId": {
          "type": "number"
        },
        "status": {
          "$ref": "#/$defs/DocumentStatus"
        },
        "templateId": {
          "type": "number"
        },
        "type": {
          "$ref": "#/$defs/DocumentType"
        },
        "url": {
          "$ref": "#/$defs/Url"
        },
        "vat": {
          "$ref": "#/$defs/Vat"
        },
        "vatRate": {
          "$ref": "#/$defs/VatRate"
        },
        "vatType": {
          "$ref": "#/$defs/VatType"
        }
      }
    },
    "Expense": {
      "allOf": [
        { "$ref": "#/$defs/ExpensePartial" },
        {
          "type": "object",
          "required": [
            "currency",
            "vat",
            "amount",
            "date",
            "reportingDate",
            "documentType",
            "number",
            "supplier",
            "accountingClassification"
          ]
        }
      ],
      "unevaluatedProperties": false
    },
    "ExpensePartial": {
      "type": "object",
      "additionalProperties": false,
      "description": "A Single Expense",
      "properties": {
        "paymentType": {
          "description": "Payment method",
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": ["string", "number"],
              "enum": ["1", "2", "3", "4", "5", "10", "11", 1, 2, 3, 4, 5, 10, 11]
            }
          ]
        },
        "currency": {
          "$ref": "#/$defs/Currency"
        },
        "currencyRate": {
          "$ref": "#/$defs/CurrencyRate"
        },
        "vat": {
          "$ref": "#/$defs/Vat"
        },
        "amount": {
          "type": "number",
          "description": "The total amount of the expense"
        },
        "date": {
          "type": "string",
          "description": "Date of the expense"
        },
        "dueDate": {
          "type": "string",
          "description": "Due date of the expense"
        },
        "reportingDate": {
          "type": "string",
          "description": "Reporting date of the expense"
        },
        "documentType": {
          "$ref": "#/$defs/ExpenseDocumentType"
        },
        "number": {
          "type": ["string", "null"],
          "description": "Number of the expense"
        },
        "description": {
          "type": "string",
          "description": "Description for the expense"
        },
        "remarks": {
          "type": "string",
          "description": "Remarks for the expense"
        },
        "supplier": {
          "$ref": "#/$defs/Supplier"
        },
        "accountingClassification": {
          "$ref": "#/$defs/AccountingClassification"
        },
        "active": {
          "type": "boolean",
          "description": "Is the expense active or not"
        },
        "addRecipient": {
          "type": "boolean",
          "description": "Should we save the supplier or not (by setting this to true you are required to add a supplier)"
        },
        "addAccountingClassification": {
          "type": "boolean",
          "description": "Should we save the accounting classification (by setting this to true you are required to add an accounting classification that contains title & irsCode)"
        }
      }
    },
    "GetExpense": {
      "type": "object",
      "additionalProperties": false,
      "description": "A Single Expense",
      "properties": {
        "amountExcludeVat": {
          "type": "number",
          "description": "The amount excluding the vat"
        },
        "id": {
          "type": "string",
          "description": "The expense ID"
        },
        "businessType": {
          "type": "number",
          "description": "The business type ID",
          "enum": [1, 2, 3, 4, 5, 6]
        },
        "documentType": {
          "$ref": "#/$defs/ExpenseDocumentType"
        },
        "status": {
          "type": "number",
          "description": "The status of the expense",
          "enum": [10, 20, 30, 100]
        },
        "paymentType": {
          "type": "number",
          "description": "Payment method",
          "enum": [-1, 0, 1, 2, 3, 4, 5, 10, 11]
        },
        "currency": {
          "$ref": "#/$defs/Currency"
        },
        "currencyRate": {
          "$ref": "#/$defs/CurrencyRate"
        },
        "vat": {
          "$ref": "#/$defs/Vat"
        },
        "amount": {
          "type": "number",
          "description": "The total amount of the expense"
        },
        "date": {
          "type": "string",
          "description": "Date of the expense"
        },
        "dueDate": {
          "type": "string",
          "description": "Due date of the expense"
        },
        "number": {
          "type": "string",
          "description": "Number of the expense"
        },
        "active": {
          "type": "boolean",
          "description": "Is the expense currently active or not"
        },
        "description": {
          "type": "string",
          "description": "Description for the expense"
        },
        "remarks": {
          "type": "string",
          "description": "Remarks for the expense"
        },
        "supplier": {
          "$ref": "#/$defs/Supplier"
        },
        "thumbnail": {
          "type": "string",
          "description": "URL of expense thumbnail"
        },
        "url": {
          "type": "string",
          "description": "URL to download the expense thumbnail"
        },
        "cancellable": {
          "type": "boolean",
          "description": "Is the supplier currently active or not"
        },
        "reportingDate": {
          "type": "string",
          "description": "Reporting date of the expense"
        },
        "accountingClassification": {
          "$ref": "#/$defs/AccountingClassification"
        },
        "amountLocal": {
          "type": "number",
          "description": "The local amount of the expense"
        },
        "amountAccounting": {
          "type": "number",
          "description": "The amount of accounting"
        },
        "vatAccounting": {
          "type": "number",
          "description": "The vat amount of accounting"
        },
        "creationDate": {
          "$ref": "#/$defs/CreationDate"
        },
        "lastUpdateDate": {
          "type": "integer",
          "description": "The last update date of the expense, in UNIX timestamp format"
        }
      }
    },
    "GetExpenseDraft": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "description": "The expense draft ID"
        },
        "status": {
          "type": "number",
          "description": "The status of the expense draft",
          "enum": [10, 50]
        },
        "creationDate": {
          "$ref": "#/$defs/CreationDate"
        },
        "lastUpdateDate": {
          "type": "integer",
          "description": "The last update date of the expense draft, in UNIX timestamp format"
        },
        "expense": {
          "$ref": "#/$defs/ExpensePartial"
        },
        "thumbnail": {
          "type": "string",
          "description": "URL of expense thumbnail"
        },
        "url": {
          "type": "string",
          "description": "URL to download the expense thumbnail"
        }
      }
    },
    "GetLinkedDocuments": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "amount": {
          "$ref": "#/$defs/DocumentAmount"
        },
        "currency": { "$ref": "#/$defs/Currency" },
        "currencyRate": {
          "$ref": "#/$defs/CurrencyRate"
        },
        "documentDate": {
          "$ref": "#/$defs/DocumentDate"
        },
        "id": {
          "$ref": "#/$defs/DocumentId"
        },
        "number": {
          "$ref": "#/$defs/DocumentTaxNumber"
        },
        "status": {
          "$ref": "#/$defs/DocumentStatus"
        },
        "type": {
          "$ref": "#/$defs/DocumentType"
        }
      }
    },
    "Income": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "amount": {
          "type": "number",
          "description": "Amount",
          "examples": [354]
        },
        "amountTotal": {
          "type": "number",
          "description": "Total amount",
          "examples": [354]
        },
        "catalogNum": {
          "type": "string",
          "description": "Catalog number",
          "examples": ["MXDFSDD"]
        },
        "currency": {
          "$ref": "#/$defs/Currency"
        },
        "currencyRate": {
          "$ref": "#/$defs/CurrencyRate"
        },
        "description": {
          "type": "string",
          "description": "Item description",
          "examples": ["Item description"],
          "minLength": 1
        },
        "itemId": {
          "type": "string",
          "description": "The ID of the item to attach as income",
          "examples": ["8b338c95-095e-46d4-b2c6-331747508759"]
        },
        "price": {
          "type": "number",
          "description": "Item price",
          "examples": [300]
        },
        "quantity": {
          "type": "number",
          "description": "Quantity",
          "examples": [1],
          "minimum": 0
        },
        "vat": {
          "$ref": "#/$defs/Vat"
        },
        "vatRate": {
          "$ref": "#/$defs/VatRate"
        },
        "vatType": {
          "$ref": "#/$defs/VatType"
        }
      },
      "required": ["description", "quantity", "price", "currency", "vatType"]
    },
    "PaginationMeta": {
      "type": "object",
      "description": "Pagination metadata for list responses",
      "additionalProperties": false,
      "required": ["total", "page", "pageSize", "pages"],
      "properties": {
        "total": {
          "type": "number",
          "description": "Total number of items",
          "minimum": 0
        },
        "page": {
          "type": "number",
          "description": "Current page number",
          "minimum": 1
        },
        "pageSize": {
          "type": "number",
          "description": "Number of items per page",
          "minimum": 1
        },
        "pages": {
          "type": "number",
          "description": "Total number of pages",
          "minimum": 0
        },
        "from": {
          "type": "number",
          "description": "Starting index",
          "minimum": 0
        },
        "to": {
          "type": "number",
          "description": "Ending index",
          "minimum": 0
        }
      }
    },
    "Payment": {
      "allOf": [
        { "$ref": "#/$defs/PaymentCore" },
        {
          "type": "object",
          "properties": {
            "amount": {
              "type": "number",
              "description": "Payment amount"
            },
            "cancellable": {
              "type": "boolean",
              "description": "Is this document a cancellable document",
              "examples": [false]
            },
            "description": {
              "type": "string",
              "description": "Payment description"
            },
            "name": {
              "type": "string",
              "description": "Payment name",
              "examples": ["העברה בנקאית"]
            },
            "ref": {
              "type": "array",
              "description": "The referred documents types",
              "items": {
                "$ref": "#/$defs/DocumentType"
              }
            }
          },
          "required": ["type", "price"]
        }
      ],
      "unevaluatedProperties": false
    },
    "PaymentDocument": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "currency": {
          "$ref": "#/$defs/Currency"
        },
        "currencyRate": {
          "$ref": "#/$defs/CurrencyRate"
        },
        "date": {
          "type": "string"
        },
        "price": {
          "type": "number",
          "description": "Sum paid",
          "examples": [300]
        },
        "type": {
          "type": "number",
          "description": "Payment method",
          "enum": [-1, 0, 1, 2, 3, 4, 5, 9, 10, 11]
        },
        "subType": {
          "type": "number",
          "description": "Other payment sub type (required when using 'other' as a Payment type)",
          "enum": [1, 2, 3, 4, 5, 6, 7, 8]
        },
        "bankName": {
          "type": "string",
          "description": "Bank name (required when using Cheques)",
          "examples": ["My Bank"]
        },
        "bankBranch": {
          "type": "string",
          "description": "Bank branch number (required when using Cheques)",
          "examples": ["212345"]
        },
        "bankAccount": {
          "type": "string",
          "description": "Bank account number (required when using Cheques)",
          "examples": ["212345"]
        },
        "chequeNum": {
          "type": "string",
          "description": "Cheque number (required when using Cheques)",
          "examples": ["10002"]
        },
        "accountId": {
          "type": "string",
          "description": "Payer account (PayPal / Payment App / Other)",
          "examples": ["TFGFFGSYYE"]
        },
        "transactionId": {
          "type": "string",
          "description": "Transaction ID (PayPal / Payment App / Other)",
          "examples": ["TGBBBXNLKS75SKJS"]
        },
        "appType": {
          "type": "integer",
          "description": "Payment app type (required when using 'payment app' as a Payment type)",
          "enum": [1, 2, 3, 4, 5, 6]
        },
        "cardType": {
          "type": "integer",
          "description": "Credit card type",
          "enum": [1, 2, 3, 4, 5]
        },
        "cardNum": {
          "type": "string",
          "description": "Credit card's last 4 digits",
          "examples": ["8765"]
        },
        "dealType": {
          "type": "integer",
          "description": "Credit card deal type",
          "enum": [1, 2, 3, 4, 5, 6]
        },
        "numPayments": {
          "type": "integer",
          "description": "Credit card's payments count (1-36)",
          "examples": [1]
        },
        "firstPayment": {
          "type": "number",
          "description": "Credit card's first payment",
          "examples": [10]
        }
      },
      "required": ["type", "price", "currency"]
    },
    "PaymentCore": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "currency": {
          "$ref": "#/$defs/Currency"
        },
        "currencyRate": {
          "$ref": "#/$defs/CurrencyRate"
        },
        "date": {
          "type": "string",
          "description": "Payment date"
        },
        "price": {
          "type": "number",
          "description": "Sum paid",
          "examples": [300],
          "minimum": 0
        },
        "type": {
          "type": "number",
          "description": "Payment method",
          "enum": [-1, 0, 1, 2, 3, 4, 5, 9, 10, 11]
        },
        "subType": {
          "type": "number",
          "description": "Other payment sub type (required when using 'other' as a Payment type)",
          "enum": [1, 2, 3, 4, 5, 6, 7, 8]
        }
      }
    },
    "Supplier": {
      "allOf": [
        { "$ref": "#/$defs/ContactInfo" },
        { "$ref": "#/$defs/Address" },
        { "$ref": "#/$defs/BankingInfo" },
        {
          "type": "object",
          "description": "Supplier of the expense",
          "properties": {
            "id": {
              "type": "string",
              "description": "The supplier ID"
            },
            "name": {
              "type": "string",
              "description": "The supplier name"
            },
            "active": {
              "type": "boolean",
              "description": "Is the supplier active or not"
            },
            "taxId": {
              "type": "string",
              "description": "The supplier tax ID"
            },
            "paymentTerms": {
              "type": "number",
              "description": "The supplier payment term, default is 0",
              "enum": [-1, 0, 10, 15, 30, 45, 60, 75, 90, 120]
            },
            "labels": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "creationDate": {
              "$ref": "#/$defs/CreationDate"
            },
            "lastUpdateDate": {
              "type": "integer",
              "description": "The last update date of the supplier, in UNIX timestamp format"
            },
            "department": {
              "type": "string",
              "description": "The supplier department"
            },
            "accountingKey": {
              "type": "string",
              "description": "The supplier accounting key"
            },
            "remarks": {
              "type": "string",
              "description": "The Supplier remarks for self use"
            },
            "incomeAmount": {
              "type": "number",
              "description": "The amount of incomes from the customer"
            },
            "paymentAmount": {
              "type": "number"
            },
            "balanceAmount": {
              "type": "number",
              "description": "The balance amount of the supplier"
            }
          }
        }
      ],
      "unevaluatedProperties": false
    },
    "ErrorResponse": {
      "type": "object",
      "additionalProperties": false,
      "description": "Error",
      "properties": {
        "errorCode": {
          "type": "number"
        },
        "errorMessage": {
          "type": "string"
        }
      }
    },
    "Url": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "he": {
          "type": "string",
          "description": "Copy in Hebrew"
        },
        "en": {
          "type": "string",
          "description": "Copy in English"
        },
        "origin": {
          "type": "string",
          "description": "Origin"
        }
      },
      "required": ["he", "origin"]
    },
    "CreationDate": {
      "type": "integer",
      "description": "The creation date, in UNIX timestamp format",
      "minimum": 0
    },
    "CurrencyRate": {
      "type": "number",
      "description": "Currency rate relative to ILS",
      "examples": [1],
      "minimum": 0,
      "exclusiveMinimum": 0
    },
    "DocumentLang": {
      "description": "Document language",
      "type": "string",
      "enum": ["en", "he"]
    },
    "DocumentDescription": {
      "description": "Document's description",
      "type": "string"
    },
    "DocumentIncome": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Income"
      }
    },
    "DocumentId": {
      "description": "Document ID",
      "type": "string"
    },
    "DocumentLinkedDocuments": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DocumentLinkedDocument"
      }
    },
    "DocumentLinkedDocument": {
      "description": "A Linked Document",
      "additionalProperties": false,
      "properties": {
        "amount": {
          "$ref": "#/$defs/DocumentAmount"
        },
        "currency": { "$ref": "#/$defs/Currency" },
        "currencyRate": {
          "$ref": "#/$defs/CurrencyRate"
        },
        "documentDate": {
          "$ref": "#/$defs/DocumentDate"
        },
        "id": {
          "$ref": "#/$defs/DocumentId"
        },
        "number": {
          "$ref": "#/$defs/DocumentTaxNumber"
        },
        "reverseCharge": {
          "type": "boolean"
        },
        "type": {
          "$ref": "#/$defs/DocumentType"
        }
      },
      "required": [
        "amount",
        "currency",
        "currencyRate",
        "documentDate",
        "id",
        "number",
        "reverseCharge",
        "type"
      ]
    },
    "DocumentPayment": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PaymentDocument"
      }
    },
    "DocumentRef": {
      "type": "array",
      "items": {
        "type": "number"
      }
    },
    "DocumentSigned": {
      "description": "Digital sign the document",
      "type": "boolean"
    },
    "DocumentTaxNumber": {
      "description": "Document tax number",
      "type": "string"
    },
    "DocumentDate": {
      "description": "Document reference date",
      "type": "string",
      "format": "date"
    },
    "DocumentDiscount": {
      "description": "Discount information",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "amount": {
          "type": "number",
          "examples": [10]
        },
        "type": {
          "type": "string",
          "description": "Discount amount type",
          "enum": ["sum", "percentage"]
        }
      },
      "required": ["type", "amount"]
    },
    "DocumentRounding": {
      "description": "Round the amounts",
      "type": "boolean"
    },
    "DocumentType": {
      "description": "Document type",
      "type": "number",
      "enum": [10, 100, 200, 210, 300, 305, 320, 330, 400, 405, 500, 600, 610]
    },
    "DocumentRemarks": {
      "type": ["string"]
    },
    "DocumentFooter": {
      "description": "Texts appearing in footer",
      "type": "string"
    },
    "DocumentData": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "tags": {
          "description": "TODO: implement",
          "type": "array"
        }
      }
    },
    "DocumentStatus": {
      "description": "Document status",
      "type": "number"
    },
    "DocumentSerialNumber": {
      "description": "Document serial number",
      "type": "integer",
      "examples": [10002],
      "minimum": 1
    },
    "DocumentAmount": {
      "description": "Total amount, in requested currency (including the VAT, Discount & Rounding)",
      "type": "number",
      "examples": [354]
    },
    "DocumentAmountDueVat": {
      "description": "Amount due VAT - Amount before VAT, and before rounding & discount (if requested)",
      "type": "number",
      "examples": [100],
      "minimum": 0
    },
    "DocumentAmountExcludeVat": {
      "description": "Amount excluded VAT - Amount that is excluded of VAT",
      "type": "number",
      "examples": [18],
      "minimum": 0
    },
    "DocumentAmountDueVatLocal": {
      "description": "Amount due VAT - local currency",
      "type": "number",
      "examples": [100],
      "minimum": 0
    },
    "DocumentAmountExemptVat": {
      "description": "Amount exempt VAT - 0 unless there's one or more items that are excluded of VAT such as mixed documents (that have both VAT excluded & included items)",
      "type": "number",
      "examples": [18],
      "minimum": 0
    },
    "DocumentAmountLocal": {
      "description": "Amount in local currency",
      "type": "number",
      "examples": [300]
    },
    "DocumentAmountOpened": {
      "description": "Amount that is still left to be paid, exists only in payment request documents",
      "type": "number",
      "examples": [300]
    },
    "ExpenseDocumentType": {
      "type": "number",
      "description": "Document type",
      "enum": [20, 305, 320, 330, 400, 405]
    },
    "Vat": {
      "description": "VAT amount",
      "type": "number",
      "examples": [54],
      "minimum": 0
    },
    "VatType": {
      "description": "VAT type",
      "type": "number",
      "enum": [0, 1, 2],
      "examples": [0]
    },
    "VatRate": {
      "type": "number",
      "description": "VAT rate",
      "minimum": 0,
      "maximum": 100
    }
  }
}
