{
	"$schema": "http://json-schema.org/draft-03/schema#",
	"title": "Account schema",
	"description": "A schema for information about an account.",
	"type": "object",
	"restdocs": "http://restdocs.e-conomic.com/#get-accounts-accountnumber",
	"properties": {
		"accountNumber": {
			"type": "integer",
			"filterable": true,
			"sortable": true,
			"description": "The account's number."
		},
		"accountType": {
			"enum": ["profitAndLoss", "status", "totalFrom", "heading", "headingStart", "sumInterval", "sumAlpha"],
			"default": "profitAndLoss",
			"filterable": true,
			"sortable": true,
			"description": "The type of account in the chart of accounts."
		},
		"balance": {
			"type": "number",
			"maxDecimal": 2,
			"filterable": true,
			"sortable": true,
			"description": "The current balanace of the account."
		},
		"draftBalance": {
			"type": "number",
			"maxDecimals": 2,
			"description": "The current balance of the account including draft (not yet booked) entries."
		},
		"barred": {
			"type": "boolean",
			"filterable": true,
			"description": "Shows if the account is barred from being used."
		},
		"blockDirectEntries": {
			"type": "boolean",
			"sortable": true,
			"filterable": true,
			"description": "Determines if the account can be manually updated with entries."
		},
		"contraAccount": {
			"type": "object",
			"description": "The default contra account of the account.",
			"properties": {
				"accountNumber": {
					"type": "integer",
					"description": "Account number of the contra account."
				},
				"self": {
					"type": "string",
					"format": "uri",
					"description": "The unique self link of the contra account.",
					"required": true
				}
			}
		},
		"debitCredit": {
			"enum": ["debit", "credit"],
			"default": "debit",
			"sortable": true,
			"filterable": true,
			"description": "Describes the default update type of the account."
		},
		"name": {
			"type": "string",
			"maxLength": 125,
			"sortable": true,
			"filterable": true,
			"description": "The name of the account."
		},
		"vatAccount": {
			"type": "object",
			"desciption": "The default VAT code for this account.",
			"properties": {
				"vatCode": {
					"type": "string",
					"maxLength": 5,
					"description": "The VAT code of the VAT account for this account."
				},
				"self": {
					"type": "string",
					"format": "uri",
					"description": "The unique self link of the VAT code.",
					"required": true
				}
			}
		},
		"accountsSummed": {
			"type": "array",
			"description": "An array of the account intervals used for calculating the total for this account.",
			"items": {
				"type": "object",
				"description": "An account interval.",
				"properties": {
					"fromAccount": {
						"type": "object",
						"description": "The first account in the interval.",
						"properties": {
							"accountNumber": {
								"type": "integer",
								"description": "Account number of the first account in the interval."
							},
							"self": {
								"type": "string",
								"format": "uri",
								"description": "The unique self link of the first account in the interval.",
								"required": true
							}
						}
					},
					"toAccount": {
						"type": "object",
						"description": "The last account in the interval.",
						"properties": {
							"accountNumber": {
								"type": "integer",
								"description": "Account number of the last account in the interval."
							},
							"self": {
								"type": "string",
								"format": "uri",
								"description": "The unique self link of the last account in the interval.",
								"required": true
							}
						}
					}
				}
			}
		},
		"totalFromAccount": {
			"type": "object",
			"description": "The account from which the sum total for this account is calculated.",
			"properties": {
				"accountNumber": {
					"type": "integer",
					"description": "Account number of the first account."
				},
				"self": {
					"type": "string",
					"format": "uri",
					"description": "The unique self link of the first account.",
					"required": true
				}
			}
		},
		"accountingYears": {
			"type": "string",
			"format": "uri",
			"description": "A link to a list of accounting years for which the account is usable."
		},
		"metaData": {
			"type": "object",
			"description": "Information about possible actions, endpoints and resource paths related to the endpoint."
		},
		"self": {
			"type": "string",
			"format": "uri",
			"description": "A unique reference to the account resource.",
			"required": true
		}
	}
}