{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","title":"Traceability register of foodstuffs (incoming and outgoing)","description":"The register in which a food operator records, for each establishment unit, the products received and the products delivered to another establishment, with the data of art. 6 of the royal decree of 14 November 2003.","additionalProperties":false,"required":["document","operator","register","signatory"],"properties":{"document":{"type":"object","additionalProperties":false,"required":["date"],"properties":{"place":{"type":"string","description":"Place where the register is drawn up (optional)."},"date":{"type":"string","format":"date","description":"Date of the register."},"reference":{"type":"string","description":"Internal reference of the register (optional)."}}},"operator":{"type":"object","additionalProperties":false,"required":["name","address"],"properties":{"name":{"type":"string","minLength":1,"description":"Name of the operator."},"enterprise_number":{"type":"string","description":"Belgian enterprise number (BCE / KBO) of the operator (optional)."},"establishment_unit_number":{"type":"string","description":"Establishment-unit number of the operator (optional)."},"address":{"type":"string","minLength":1,"description":"Address of the establishment."}}},"register":{"type":"object","additionalProperties":false,"required":["scope"],"properties":{"scope":{"type":"string","enum":["incoming","outgoing","both"],"description":"Which sections the register holds: incoming products, outgoing products or both."},"period_from":{"type":"string","format":"date","description":"First day of the register period (optional)."},"period_to":{"type":"string","format":"date","description":"Last day of the register period (optional)."},"regime":{"type":"string","enum":["standard","relaxed"],"description":"The traceability regime the operator states it applies (optional)."},"kept_by":{"type":"string","description":"Person who keeps the register (optional)."},"retention_stated":{"type":"string","description":"How long the operator keeps this register, in its own words (optional)."},"incoming":{"type":"array","minItems":1,"description":"The products received (incoming section).","items":{"type":"object","additionalProperties":false,"required":["received_on","product","identification","quantity","unit","supplier"],"properties":{"received_on":{"type":"string","format":"date","description":"Date of reception."},"product":{"type":"string","minLength":1,"description":"Nature of the product received."},"identification":{"type":"string","minLength":1,"description":"Identification of the product as the supplier gave it (lot, code, date)."},"quantity":{"type":"string","pattern":"^[0-9]+([.,][0-9]+)?$","description":"Quantity as the operator records it, decimals kept (for example 250 or 12,5)."},"unit":{"type":"string","minLength":1,"description":"Unit of the quantity (free text, for example kg, pieces)."},"supplier":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","minLength":1,"description":"Name of the supplier."},"unit_number":{"type":"string","description":"Establishment-unit number of the supplier (optional)."},"address":{"type":"string","description":"Address of the supplier (optional)."},"country":{"type":"string","description":"Country of the supplier (optional)."}}},"document_reference":{"type":"string","description":"Reference of the delivery note or invoice (optional)."},"temperature_stated":{"type":"string","description":"Temperature at reception as the operator records it (optional)."},"remarks":{"type":"string","description":"Free remarks (optional)."}}}},"outgoing":{"type":"array","minItems":1,"description":"The products delivered to another establishment (outgoing section).","items":{"type":"object","additionalProperties":false,"required":["delivered_on","product","identification","quantity","unit","recipient"],"properties":{"delivered_on":{"type":"string","format":"date","description":"Date of delivery."},"product":{"type":"string","minLength":1,"description":"Nature of the product delivered."},"identification":{"type":"string","minLength":1,"description":"Identification of the product delivered (lot, code, date)."},"quantity":{"type":"string","pattern":"^[0-9]+([.,][0-9]+)?$","description":"Quantity as the operator records it, decimals kept (for example 250 or 12,5)."},"unit":{"type":"string","minLength":1,"description":"Unit of the quantity (free text, for example kg, pieces)."},"recipient":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","minLength":1,"description":"Name of the recipient."},"unit_number":{"type":"string","description":"Establishment-unit number of the recipient (optional)."},"address":{"type":"string","description":"Address of the recipient (optional)."}}},"document_reference":{"type":"string","description":"Reference of the delivery note or invoice (optional)."},"linked_incoming_reference":{"type":"string","description":"Reference of the incoming product or lot this delivery is linked to (optional)."},"remarks":{"type":"string","description":"Free remarks (optional)."}}}}},"allOf":[{"if":{"properties":{"scope":{"enum":["incoming","both"]}},"required":["scope"]},"then":{"required":["incoming"]}},{"if":{"properties":{"scope":{"enum":["outgoing","both"]}},"required":["scope"]},"then":{"required":["outgoing"]}}]},"signatory":{"type":"object","additionalProperties":false,"required":["name","title"],"properties":{"name":{"type":"string","minLength":1,"description":"Name of the person who signs."},"title":{"type":"string","minLength":1,"description":"Function of the person who signs."}}}}}