{
	"$schema": "http://json-schema.org/draft-03/schema#",
	"title": "Product groups collection GET schema",
	"description": "A schema for retrieval of a collection of product groups.",
	"type": "object",
	"restdocs": "http://restdocs.e-conomic.com/#get-product-groups",
	"properties": {
		"collection": {
			"type": "array",
			"description": "The array containing all the product groups.",
			"items": {
				"title": "Product group",
				"type": "object",
				"description": "A specific product group.",
				"properties": {
					"productGroupNumber": {
						"type": "integer",
						"description": "Unique number identifying the product group."
					},
					"name": {
						"type": "string",
						"minLength": 1,
						"maxLength": 50,
						"description": "Descriptive name of the product group."
					},
					"salesAccounts": {
						"type": "string",
						"format": "uri",
						"readOnly": true,
						"description": "A reference to the sales accounts in this product group resource."
					},
					"products": {
						"type": "string",
						"format": "uri",
						"readOnly": true,
						"description": "A reference to the products in this product group resource."
					},
					"inventoryEnabled": {
						"type": "boolean",
						"readOnly": true,
						"description": "States if the product group is inventory enabled or not."
					},
					"accrual": {
						"type": "object",
						"readOnly": true,
						"description": "A reference to the accrual account this product group is connected to.",
						"properties": {
							"accountNumber": {
								"type": "integer",
								"readOnly": true,
								"description": "Unique number identifying the accruals account."
							},
							"accountType": {
								"enum": ["profitAndLoss", "status", "totalFrom", "heading", "headingStart", "sumInterval", "sumAlpha"],
								"default": "profitAndLoss",
								"readOnly": true,
								"description": "The type of account in the chart of accounts."
							},
							"balance": {
								"type": "number",
								"maxDecimal": 2,
								"readOnly": true,
								"description": "The current balance of the accruals account."
							},
							"draftBalance": {
								"type": "number",
								"maxDecimals": 2,
								"readOnly": true,
								"description": "The current balance of the account including draft (not yet booked) entries."
							},
							"barred": {
								"type": "boolean",
								"readOnly": true,
								"description": "Shows if the account is barred from being used."
							},
							"blockDirectEntries": {
								"type": "boolean",
								"readOnly": true,
								"description": "Determines if the account can be manually updated with entries."
							},
							"contraAccount": {
								"type": "object",
								"readOnly": true,
								"description": "The default contra account of the account.",
								"properties": {
									"accountNumber": {
										"type": "integer",
										"readOnly": true,
										"description": "Account number of the contra account."
									},
									"self": {
										"type": "string",
										"format": "uri",
										"readOnly": true,
										"description": "The unique self link of the contra account.",
										"required": true
									}
								}
							},
							"debitCredit": {
								"enum": ["debit", "credit"],
								"default": "debit",
								"readOnly": true,
								"description": "Describes the default update type of the account."
							},
							"name": {
								"type": "string",
								"maxLength": 125,
								"readOnly": true,
								"description": "The name of the account."
							},
							"vatAccount": {
								"type": "object",
								"readOnly": true,
								"desciption": "The default VAT code for this account.",
								"properties": {
									"vatCode": {
										"type": "string",
										"maxLength": 5,
										"readOnly": true,
										"description": "The VAT code of the VAT account for this account."
									},
									"self": {
										"type": "string",
										"format": "uri",
										"readOnly": true,
										"description": "The unique self link of the VAT code.",
										"required": true
									}
								}
							},
							"accountsSummed": {
								"type": "array",
								"readOnly": true,
								"description": "An array of the account intervals used for calculating the total for this account.",
								"items": {
									"type": "object",
									"readOnly": true,
									"description": "An account interval.",
									"properties": {
										"fromAccount": {
											"type": "object",
											"readOnly": true,
											"description": "The first account in the interval.",
											"properties": {
												"accountNumber": {
													"type": "integer",
													"readOnly": true,
													"description": "Account number of the first account in the interval."
												},
												"self": {
													"type": "string",
													"format": "uri",
													"readOnly": true,
													"description": "The unique self link of the first account in the interval.",
													"required": true
												}
											}
										},
										"toAccount": {
											"type": "object",
											"readOnly": true,
											"description": "The last account in the interval.",
											"properties": {
												"accountNumber": {
													"type": "integer",
													"readOnly": true,
													"description": "Account number of the last account in the interval."
												},
												"self": {
													"type": "string",
													"format": "uri",
													"readOnly": true,
													"description": "The unique self link of the last account in the interval.",
													"required": true
												}
											}
										}
									}
								}
							},
							"totalFromAccount": {
								"type": "object",
								"readOnly": true,
								"description": "The account from which the sum total for this account is calculated.",
								"properties": {
									"accountNumber": {
										"type": "integer",
										"readOnly": true,
										"description": "Account number of the first account."
									},
									"self": {
										"type": "string",
										"format": "uri",
										"readOnly": true,
										"description": "The unique self link of the first account.",
										"required": true
									}
								}
							},
							"accountingYears": {
								"type": "string",
								"format": "uri",
								"readOnly": true,
								"description": "A link to a list of accounting years for which the account is usable."
							}
						},
						"self": {
							"type": "string",
							"format": "uri",
							"readOnly": true,
							"description": "A unique reference to the accruals account resource.",
							"required": true
						}
					},
					"self": {
						"type": "string",
						"format": "uri",
						"description": "A unique reference to this product group resource.",
						"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 product groups collection.",
			"required": true
		}
	}
}