{"success":true,"data":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Json2doc Template Schema","description":"JSON schema for generating documents from templates by replacing variables","type":"object","required":[],"additionalProperties":false,"properties":{"templateId":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[a-zA-Z0-9_-]+$","description":"ID of the template to use (original format)"},"templatePath":{"type":"string","minLength":1,"maxLength":500,"pattern":"^/.*","description":"MinIO path to template file (processed format)"},"variables":{"type":"object","description":"Variables to replace in the template. Use {{varName}} in template. Supports strings, images, tables, and lists.","additionalProperties":{"oneOf":[{"type":"string","minLength":1,"maxLength":1000,"description":"Simple text variable"},{"type":"object","required":["type","src"],"additionalProperties":false,"properties":{"type":{"type":"string","const":"image","description":"Image replacement"},"src":{"type":"string","minLength":1,"maxLength":500,"oneOf":[{"pattern":"^/image/.*","description":"Local Storage image path from file upload (must start with /image/)"},{"pattern":"^https?://.*","description":"Public HTTP/HTTPS URL"}],"description":"Image file path (storage URL starting with /image/ or public HTTP/HTTPS URL)"},"alt":{"type":"string","maxLength":200,"description":"Alternative text for accessibility"},"width":{"type":"number","minimum":10,"maximum":2000,"description":"Image width in pixels"},"height":{"type":"number","minimum":10,"maximum":2000,"description":"Image height in pixels"}},"description":"Image to replace placeholder"},{"type":"object","required":["type","data"],"additionalProperties":false,"properties":{"type":{"type":"string","const":"table","description":"Dynamic table data"},"data":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","description":"Row data as key-value pairs matching template placeholders"},"description":"Array of row objects with properties matching template column placeholders"}},"description":"Table data to populate template table rows"},{"type":"object","required":["type","items"],"additionalProperties":false,"properties":{"type":{"type":"string","const":"list","description":"List of items"},"items":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","minLength":1,"maxLength":1000},"description":"List items to insert"}},"description":"List items to insert at placeholder position"},{"type":"object","required":["type","qrType","data"],"additionalProperties":false,"properties":{"type":{"type":"string","const":"qrcode","description":"QR code to generate and insert"},"qrType":{"type":"string","enum":["url","wifi","vcard"],"description":"Type of QR code: url (link), wifi (WiFi credentials), vcard (contact card)"},"data":{"type":"object","description":"QR code data (structure depends on qrType)"},"size":{"type":"number","minimum":50,"maximum":1000,"default":200,"description":"QR code size in pixels (width and height, always 1:1 ratio)"},"errorCorrection":{"type":"string","enum":["L","M","Q","H"],"default":"M","description":"Error correction level: L (~7%), M (~15%), Q (~25%), H (~30%)"}},"allOf":[{"if":{"properties":{"qrType":{"const":"url"}}},"then":{"properties":{"data":{"type":"object","required":["url"],"additionalProperties":false,"properties":{"url":{"type":"string","minLength":1,"maxLength":2000,"description":"URL to encode in QR code"}}}}}},{"if":{"properties":{"qrType":{"const":"wifi"}}},"then":{"properties":{"data":{"type":"object","required":["ssid"],"additionalProperties":false,"properties":{"ssid":{"type":"string","minLength":1,"maxLength":32,"description":"WiFi network name (SSID)"},"password":{"type":"string","maxLength":63,"description":"WiFi password (optional for open networks)"},"encryption":{"type":"string","enum":["WPA","WEP","nopass"],"default":"WPA","description":"WiFi encryption type"},"hidden":{"type":"boolean","default":false,"description":"Whether the network is hidden"}}}}}},{"if":{"properties":{"qrType":{"const":"vcard"}}},"then":{"properties":{"data":{"type":"object","additionalProperties":false,"properties":{"firstName":{"type":"string","maxLength":100,"description":"First name"},"lastName":{"type":"string","maxLength":100,"description":"Last name"},"organization":{"type":"string","maxLength":100,"description":"Organization/Company name"},"phone":{"type":"string","maxLength":50,"description":"Phone number"},"email":{"type":"string","format":"email","maxLength":100,"description":"Email address"},"url":{"type":"string","maxLength":200,"description":"Website URL"},"address":{"type":"string","maxLength":200,"description":"Physical address"},"note":{"type":"string","maxLength":500,"description":"Additional notes"}}}}}}],"description":"QR code to generate and insert at placeholder position"}]},"maxProperties":50,"propertyNames":{"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_]*$","minLength":1,"maxLength":50}},"output":{"type":"object","description":"Optional output settings to override template defaults","additionalProperties":false,"properties":{"filename":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[a-zA-Z0-9_-]+$","description":"Override the output filename"},"type":{"type":"string","enum":["docx","pdf"],"default":"docx","description":"Output document format"}}}},"anyOf":[{"required":["templateId"],"not":{"required":["templatePath"]}},{"required":["templatePath"],"not":{"required":["templateId"]}}],"examples":[{"templateId":"invoice-template-2024","variables":{"companyName":"Acme Corporation","invoiceNumber":"INV-2024-001","date":"2024-01-15","customerName":"John Doe","amount":"$1,250.00","items":{"type":"table","data":[{"description":"Web Development","quantity":"10","price":"$100.00","total":"$1,000.00"},{"description":"Consulting","quantity":"5","price":"$50.00","total":"$250.00"}]}},"output":{"filename":"invoice-2024-001","type":"pdf"}}]},"description":"JSON schema for template-based document configuration","version":"1.0","type":"json"},"message":"Template schema retrieved successfully"}