{
	"$schema": "http://json-schema.org/draft-03/schema#",
	"title": "Booked invoice collection schema",
	"description": "A schema for retrieving a collection of overdue invoices.",
	"type": "object",
	"restdocs": "http://restdocs.e-conomic.com/#get-invoices-overdue",
	"properties": {
		"collection": {
			"type": "array",
			"description": "A collection of overdue invoices.",
			"items": {
				"title": "Overdue invoice",
				"type": "object",
				"properties": {
					"bookedInvoiceNumber": {
						"type": "integer",
						"minimum": 1,
						"filterable": true,
						"sortable": true,
						"description": "A reference number for the booked invoice document."
					},
					"date": {
						"type": "string",
						"format": "full-date",
						"pattern": "\\d{4}-\\d{2}-\\d{2}",
						"filterable": true,
						"sortable": true,
						"description": "Invoice issue date. Format according to ISO-8601 (YYYY-MM-DD)."
					},
					"currency": {
						"type": "string",
						"pattern": "[a-zA-Z]{3}",
						"filterable": true,
						"sortable": true,
						"description": "The ISO 4217 currency code of the invoice."
					},
					"netAmount": {
						"type": "number",
						"maxDecimal": 2,
						"description": "The total invoice amount in the invoice currency before all taxes and discounts have been applied. For a credit note this amount will be negative."
					},
					"netAmountInBaseCurrency": {
						"type": "number",
						"maxDecimal": 2,
						"description": "The total invoice amount in the base currency of the agreement before all taxes and discounts have been applied. For a credit note this amount will be negative."
					},
					"grossAmount": {
						"type": "number",
						"maxDecimal": 2,
						"description": "The total invoice amount in the invoice currency after all taxes and discounts have been applied. For a credit note this amount will be negative."
					},
					"vatAmount": {
						"type": "number",
						"maxDecimal": 2,
						"description": "The total amount of VAT on the invoice in the invoice currency. This will have the same sign as net amount"
					},
					"roundingAmount": {
						"type": "number",
						"maxDecimal": 2,
						"description": "The total rounding error, if any, on the invoice in base currency."
					},
					"remainder": {
						"type": "number",
						"maxDecimal": 2,
						"readonly": true,
						"description": "Remaining amount to be paid."
					},
					"remainderInBaseCurrency": {
						"type": "number",
						"maxDecimal": 2,
						"readonly": true,
						"description": "Remaining amount to be paid in base currency."
					},
					"dueDate": {
						"type": "string",
						"format": "full-date",
						"pattern": "\\d{4}-\\d{2}-\\d{2}",
						"description": "The date the invoice is due for payment. Format according to ISO-8601 (YYYY-MM-DD). This is only used if the terms of payment is of type 'duedate'."
					},
					"paymentTerms": {
						"type": "object",
						"description": "The terms of payment for the invoice.",
						"properties": {
							"paymentTermsNumber": {
								"type": "integer",
								"minimum": 0,
								"exclusiveMinimum": true,
								"filterable": true,
								"sortable": true,
								"description": "A unique identifier of the payment term."
							},
							"daysOfCredit": {
								"type": "integer",
								"minimum": 0,
								"description": "The number of days of credit on the invoice. This field is only valid if terms of payment is not of type 'duedate"
							},
							"name": {
								"type": "string",
								"maxLength": 50,
								"description": "The name of the payment terms."
							},
							"paymentTermsType": {
								"type": "string",
								"maxLength": 30,
								"description": "The type the payment term."
							},
							"self": {
								"type": "string",
								"format": "uri",
								"description": "A unique reference to the payment term resource.",
								"required": true
							}
						}
					},
					"customer": {
						"type": "object",
						"description": "The customer being invoiced.",
						"properties": {
							"customerNumber": {
								"type": "integer",
								"maximum": 999999999,
								"minimum": 1,
								"filterable": true,
								"sortable": true,
								"description": "The customer id number. The customer id number can be either positive or negative, but it can't be zero."
							},
							"self": {
								"type": "string",
								"format": "uri",
								"description": "A unique reference to the customer resource.",
								"required": true
							}
						}
					},
					"recipient": {
						"type": "object",
						"description": "The actual recipient of the invoice. This may be the same info found on the customer (and will probably be so in most cases) but it may also be a different recipient. For instance, the customer placing the order may be ACME Headquarters, but the recipient of the invoice may be ACME IT.",
						"properties": {
							"name": {
								"type": "string",
								"maxLength": 250,
								"filterable": true,
								"sortable": true,
								"description": "The name of the actual recipient."
							},
							"address": {
								"type": "string",
								"maxLength": 250,
								"filterable": true,
								"sortable": true,
								"description": "The street address of the actual recipient."
							},
							"zip": {
								"type": "string",
								"maxLength": 50,
								"filterable": true,
								"sortable": true,
								"description": "The zip code of the actual recipient."
							},
							"city": {
								"type": "string",
								"maxLength": 250,
								"filterable": true,
								"sortable": true,
								"description": "The city of the actual recipient."
							},
							"country": {
								"type": "string",
								"maxLength": 50,
								"filterable": true,
								"sortable": true,
								"description": "The country of the actual recipient."
							},
							"ean": {
								"type": "string",
								"maxLength": 13,
								"filterable": true,
								"sortable": true,
								"description": "The 'European Article Number' of the actual recipient."
							},
							"publicEntryNumber": {
								"type": "string",
								"maxLength": 40,
								"filterable": true,
								"sortable": true,
								"description": "The public entry number of the actual recipient."
							},
							"attention": {
								"type": "object",
								"description": "The person to whom this invoice is addressed.",
								"properties": {
									"customerContactNumber": {
										"type": "integer",
										"description": "Unique identifier of the customer employee."
									},
									"self": {
										"type": "string",
										"format": "uri",
										"description": "A unique reference to the customer employee.",
										"required": true
									}
								}
							},
							"vatZone": {
								"type": "object",
								"description": "Recipient vat zone.",
								"properties": {
									"vatZoneNumber": {
										"type": "integer",
										"filterable": true,
										"sortable": true,
										"description": "Unique identifier of the vat zone."
									},
									"self": {
										"type": "string",
										"format": "uri",
										"description": "A unique reference to the vat zone.",
										"required": true
									}
								}
							},
							"cvr": {
								"type": "string",
								"description": "The Corporate Identification Number of the recipient for example CVR in Denmark.",
								"maxLength": 40
							}
						}
					},
					"deliveryLocation": {
						"type": "object",
						"description": "A reference to the place of delivery for the goods on the invoice",
						"properties": {
							"deliveryLocationNumber": {
								"type": "integer",
								"filterable": true,
								"sortable": true,
								"description": "A unique identifier for the delivery location."
							},
							"self": {
								"type": "string",
								"format": "uri",
								"description": "A unique reference to the delivery location resource.",
								"required": true
							}
						}
					},
					"delivery": {
						"type": "object",
						"description": "The actual place of delivery for the goods on the invoice. This is usually the same place as the one referenced in the deliveryLocation property, but may be edited as required.",
						"properties": {
							"address": {
								"type": "string",
								"maxLength": 255,
								"filterable": true,
								"sortable": true,
								"description": "Street address where the goods must be delivered to the customer."
							},
							"zip": {
								"type": "string",
								"maxLength": 30,
								"filterable": true,
								"sortable": true,
								"description": "The zip code of the place of delivery."
							},
							"city": {
								"type": "string",
								"maxLength": 50,
								"filterable": true,
								"sortable": true,
								"description": "The city of the place of delivery"
							},
							"country": {
								"type": "string",
								"maxLength": 50,
								"filterable": true,
								"sortable": true,
								"description": "The country of the place of delivery"
							},
							"deliveryTerms": {
								"type": "string",
								"maxLength": 100,
								"filterable": true,
								"sortable": true,
								"description": "Details about the terms of delivery."
							},
							"deliveryDate": {
								"type": "string",
								"format": "full-date",
								"pattern": "\\d{4}-\\d{2}-\\d{2}",
								"filterable": true,
								"sortable": true,
								"description": "The date of delivery."
							}
						}
					},
					"notes": {
						"type": "object",
						"description": "Notes on the invoice.",
						"properties": {
							"heading": {
								"type": "string",
								"maxLength": 250,
								"filterable": true,
								"sortable": true,
								"description": "The invoice heading. Usually displayed at the top of the invoice."
							},
							"textLine1": {
								"type": "string",
								"maxLength": 1000,
								"filterable": true,
								"sortable": true,
								"description": "The first line of supplementary text on the invoice. This is usually displayed right under the heading in a smaller font."
							},
							"textLine2": {
								"type": "string",
								"maxLength": 1000,
								"filterable": true,
								"sortable": true,
								"description": "The second line of supplementary text in the notes on the invoice. This is usually displayed as a footer on the invoice."
							}
						}
					},
					"references": {
						"type": "object",
						"description": "Customer and company references related to this invoice.",
						"properties": {
							"customerContact": {
								"type": "object",
								"description": "The customer contact is a reference to the employee at the customer to contact regarding the invoice.",
								"properties": {
									"customerContactNumber": {
										"type": "integer",
										"minimum": 0,
										"exclusiveMinimum": true,
										"description": "Unique identifier of the customer contact."
									},
									"customer": {
										"type": "object",
										"description": "The customer this contact belongs to.",
										"properties": {
											"customerNumber": {
												"type": "integer",
												"maximum": 999999999,
												"minimum": 1,
												"filterable": true,
												"sortable": true,
												"description": "The customer id number. The customer id number can be either positive or negative, but it can't be zero."
											},
											"self": {
												"type": "string",
												"format": "uri",
												"description": "A unique reference to the customer resource.",
												"required": true
											}
										}
									},
									"self": {
										"type": "string",
										"format": "uri",
										"description": "A unique reference to the customer contact resource.",
										"required": true
									}
								}
							},
							"salesPerson": {
								"type": "object",
								"description": "The sales person is a reference to the employee who sold the goods on the invoice. This is also the person who is credited with this sale in reports.",
								"properties": {
									"employeeNumber": {
										"type": "integer",
										"minimum": 1,
										"filterable": true,
										"sortable": true,
										"description": "Unique identifier of the employee."
									},
									"self": {
										"type": "string",
										"format": "uri",
										"description": "A unique reference to the employee resource.",
										"required": true
									}
								}
							},
							"vendorReference": {
								"type": "object",
								"description": "A reference to any second employee involved in the sale.",
								"properties": {
									"employeeNumber": {
										"type": "integer",
										"minimum": 1,
										"filterable": true,
										"sortable": true,
										"description": "Unique identifier of the employee."
									},
									"self": {
										"type": "string",
										"format": "uri",
										"description": "A unique reference to the employee resource.",
										"required": true
									}
								}
							},
							"other": {
								"type": "string",
								"maxLength": 250,
								"filterable": true,
								"sortable": true,
								"description": "A text field that can be used to save any custom reference on the invoice."
							}
						}
					},
					"pdf": {
						"type": "object",
						"description": "References a pdf representation of this invoice.",
						"properties": {
							"download": {
								"type": "string",
								"format": "uri",
								"description": "The unique reference of the pdf representation for this booked invoice.",
								"required": true
							}
						}
					},
					"layout": {
						"type": "object",
						"description": "Layout to be applied for this invoice.",
						"properties": {
							"layoutNumber": {
								"type": "integer",
								"description": "The unique identifier of the layout."
							},
							"self": {
								"type": "string",
								"format": "uri",
								"description": "A unique link reference to the layout item.",
								"required": true
							}
						}
					},
					"project": {
						"type": "object",
						"description": "A reference to any project this entry might be related to. This requires the projects module to be enabled.",
						"properties": {
							"projectNumber": {
								"type": "integer",
								"minimum": 1,
								"description": "A unique identifier of the project."
							},
							"self": {
								"type": "string",
								"format": "uri",
								"description": "A unique reference to the project resource.",
								"required": true
							}
						}
					},
					"sent": {
						"type": "string",
						"format": "uri",
						"description": "A convenience link to see if the invoice has been sent or not."
					},
					"self": {
						"type": "string",
						"format": "uri",
						"description": "The unique self reference of the booked invoice.",
						"required": true
					}
				}
			}
		},
		"metaData": {
			"type": "object",
			"description": "Information about possible actions, endpoints and resource paths related to the endpoint."
		},
		"pagination": {
			"type": "object",
			"description": "Information about the pagination."
		},
		"self": {
			"type": "string",
			"format": "uri",
			"description": "The unique self reference of the overdue booked invoice collection.",
			"required": true
		}
	}
}
