﻿{
	"$schema": "http://json-schema.org/draft-03/schema#",
	"title": "Products create schema",
	"description": "A schema for creating a new product.",
	"type": "object",
	"restdocs": "http://api-docs.reviso.com/#span-classpostpostspan-products",
	"properties": {
		"productNumber": {
			"required": true,
			"type": "string",
			"minLength": 1,
			"maxLength": 25,
			"description": "Unique alphanumeric product number."
		},
		"name": {
			"required": true,
			"type": "string",
			"minLength": 1,
			"maxLength": 300,
			"description": "Descriptive name of the product."
		},
		"description": {
			"type": "string",
			"maxLength": 500,
			"description": "Free text description of product."
		},
		"costPrice": {
			"type": "number",
			"description": "The cost of the goods. If you have the inventory module enabled, this is read-only and will just be ignored."
		},
		"recommendedPrice": {
			"type": "number",
			"description": "Recommended retail price of the goods."
		},
		"recommendedCostPrice": {
			"type": "number",
			"description": "Recommended cost price of the goods."
		},
		"salesPrice": {
			"type": "number",
			"description": "This is the unit net price that will appear on invoice lines when a product is added to an invoice line."
		},
		"barCode": {
			"type": "string",
			"maxLength": 50,
			"description": "String representation of a machine readable barcode symbol that represents this product."
		},
		"barred": {
			"type": "boolean",
			"description": "If this value is true, then the product can no longer be sold, and trying to book an invoice with this product will not be possible."
		},
		"tags": {
			"type": "array",
			"items": [
				{
					"type": "string"
				}
			],
			"description": "Tags associated with the product."
		},
		"inventory": {
			"type": "object",
			"description": "A collection of properties that are only applicable if the inventory module is enabled.",
			"properties": {
				"available": {
					"type": "number",
					"readOnly": true,
					"description": "The number of units available to sell. This is the difference between the amount in stock and the amount ordered by customers."
				},
				"inStock": {
					"type": "number",
					"readOnly": true,
					"description": "The number of units in stock including any that have been ordered by customers."
				},
				"orderedByCustomers": {
					"type": "number",
					"readOnly": true,
					"description": "The number of units that have been ordered by customers, but haven't been sold yet."
				},
				"orderedFromSuppliers": {
					"type": "number",
					"readOnly": true,
					"description": "The number of units that have been ordered from your suppliers, but haven't been delivered to you yet."
				},
				"packageVolume": {
					"type": "number",
					"description": "The volume the shipped package makes up."
				}
			}
		},
		"unit": {
			"type": "object",
			"description": "A reference to the unit this product is counted in.",
			"properties": {
				"unitNumber": {
					"type": "integer",
					"description": "Unique number identifying the unit."
				},
				"self": {
					"type": "string",
					"format": "uri",
					"description": "A unique reference to the unit resource."
				}
			}
		},
		"productGroup": {
			"type": "object",
			"required": true,
			"description": "A reference to the product group this product is contained within.",
			"properties": {
				"productGroupNumber": {
					"type": "integer",
					"description": "Unique number identifying the product group."
				},
				"self": {
					"type": "string",
					"format": "uri",
					"description": "A unique reference to the product group resource."
				}
			}
		},
		"department": {
			"type": "object",
			"description": "A reference to the department that will receive credit for the revenue generated by sales of this product. If you have set a value on this property you cannot set a value in the property distributionKey. You need to enable the Dimension module to use this. If dimension is not enabled this will just be ignored.",
			"properties": {
				"departmentNumber": {
					"type": "integer",
					"description": "Unique number identifying the department."
				},
				"self": {
					"type": "string",
					"format": "uri",
					"description": "A unique reference to the department resource."
				}
			},
			"distributionKey": {
				"type": "object",
				"description": "A reference to the distribution key that defines what departments that will receive credit for the revenue generated by sales of this product, and how credit is distributed. If you have set a value on this property you cannot set a value in the property department. You need to enable the Dimension module to use this. If dimension is not enabled this will just be ignored.",
				"properties": {
					"departmentNumber": {
						"type": "integer",
						"description": "Unique number identifying the distribution key."
					},
					"self": {
						"type": "string",
						"format": "uri",
						"description": "A unique reference to the distribution key resource."
					}
				}
			}
		}
	}
}
