{"openapi":"3.0.3","info":{"title":"InvogerPOS API","version":"1.2.0","description":"Official OpenAPI 3.0.3 specification for InvogerPOS covering authentication, POS invoicing, inventory, products, outlets, promotions, contacts, reports, RBAC administration, webhooks, OAuth2 M2M tokens, and Model Context Protocol (MCP).","contact":{"name":"InvogerPOS Support","email":"support@invoger.com","url":"https://invoger.com"}},"servers":[{"url":"https://api.invoger.com","description":"Production Server"},{"url":"http://localhost:3000","description":"Local Development Server"}],"tags":[{"name":"Authentication","description":"Cookie-less Bearer JWT authentication, token refresh, profile updates, and menu route authorization."},{"name":"Invoices","description":"POS invoicing, atomic stock deduction, voiding, tabs configuration, and receipt reprint lookup."},{"name":"Products","description":"Product catalog, variants, categories, brands, suppliers, tags, uniqueness checks, and XLSX import."},{"name":"Inventory","description":"Outlet-isolated inventory tracking, movement audit history, and idempotent stock adjustments."},{"name":"Outlets","description":"Physical store outlet management, outlet scoping, and batch XLSX import."},{"name":"Promotions","description":"Percentage, nominal, and tiered promotional pricing rules."},{"name":"Contacts","description":"Customer and contact directory CRUD endpoints."},{"name":"Dashboard","description":"Aggregated realtime sales dashboard metrics."},{"name":"Reports","description":"Realtime sales summary and product sales breakdown based on server persistence time (`createdAt`)."},{"name":"Users","description":"Tenant user management, role/group/outlet assignments, activation toggles, and archiving."},{"name":"Roles","description":"Custom RBAC role definitions and anti-escalation permission controls."},{"name":"User Groups","description":"Outlet restriction scopes and module-level access groups."},{"name":"Print Settings","description":"Thermal receipt header and footer templates per outlet."},{"name":"Integrations","description":"M2M integration tokens, OAuth2 client credentials, outbound webhooks, delivery logs, rate limits, and audit telemetry."},{"name":"MCP","description":"Streamable HTTP JSON-RPC 2.0 endpoint for Model Context Protocol clients."},{"name":"OpenAPI","description":"Machine-readable OpenAPI 3.0.3 schema document endpoint."}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Pass a Supabase Bearer JWT (from POST /api/auth/login), an OAuth2 M2M token (from POST /api/integrations/oauth2/token), or an integration token (inv_live_...) in the Authorization header."},"integrationTokenHeader":{"type":"apiKey","in":"header","name":"X-Invoger-Token","description":"Alternative custom header accepted by /api/mcp for long-lived integration tokens (inv_live_...)."}},"schemas":{"ApiErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[false],"description":"Always false for error responses.","example":false},"message":{"type":"string","description":"Human-readable error message.","example":"Bad Request"},"errors":{"nullable":true,"description":"Optional field validation tree or extra error details.","example":null}},"required":["success","message"]},"AuthLoginErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[false],"description":"Always false on authentication failure.","example":false},"error":{"type":"string","description":"Authentication failure description.","example":"Invalid login credentials"}},"required":["success","error"]},"ForbiddenPermissionErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[false],"example":false,"description":"Success (false)."},"code":{"type":"string","enum":["MISSING_PERMISSION"],"description":"Authorization error code.","example":"MISSING_PERMISSION"},"status":{"type":"string","enum":["Forbidden"],"example":"Forbidden","description":"Status (Forbidden)."},"message":{"type":"string","description":"Role and missing permission details.","example":"Role \"Cashier\" does not have permission \"users.view\"."},"data":{"type":"object","properties":{"allowed":{"type":"boolean","enum":[false],"example":false,"description":"Allowed (false)."},"role":{"type":"string","example":"Cashier","description":"Role."},"requiredPermission":{"type":"string","example":"users.view","description":"Required Permission."}},"required":["allowed","role","requiredPermission"],"description":"Data."}},"required":["success","code","status","message","data"]},"McpJsonRpcErrorResponse":{"type":"object","properties":{"jsonrpc":{"type":"string","enum":["2.0"],"example":"2.0","description":"Jsonrpc (2.0)."},"error":{"type":"object","properties":{"code":{"type":"integer","description":"JSON-RPC error code.","example":-32000},"message":{"type":"string","description":"JSON-RPC error detail.","example":"Unauthorized: Missing Invoger integration token."}},"required":["code","message"],"description":"Error."},"id":{"anyOf":[{"type":"string"},{"type":"number"},{"nullable":true}],"example":null,"description":"Id."}},"required":["jsonrpc","error","id"]},"GenericSuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true],"example":true,"description":"Success (true)."},"message":{"type":"string","example":"Success","description":"Message."},"data":{"nullable":true,"description":"Response payload or null.","example":{}}},"required":["success","message"]},"SubmitInvoiceSchema":{"type":"object","properties":{"Invoice":{"type":"object","properties":{"IdempotencyKey":{"type":"string","format":"uuid","description":"Idempotency Key UUID identifier."},"idempotencyKey":{"type":"string","format":"uuid","description":"Idempotency Key UUID identifier."},"ID":{"type":"string","description":"ID."},"InvoiceNumber":{"type":"string","description":"Invoice Number."},"Rawdate":{"anyOf":[{"type":"string"},{"type":"string","format":"date-time"}],"description":"Rawdate."},"Fulldate":{"type":"string","description":"Fulldate."},"Items":{"type":"array","items":{"type":"object","properties":{"ID":{"type":"string","description":"ID."},"productId":{"type":"string","format":"uuid","description":"Product Id UUID identifier."},"variantId":{"type":"string","format":"uuid","description":"Variant Id UUID identifier."},"variantName":{"type":"string","maxLength":120,"description":"Variant Name. (max length 120)"},"label":{"type":"string","description":"Label."},"quantity":{"type":"number","nullable":true,"description":"Quantity."},"unitPrice":{"type":"number","nullable":true,"description":"Unit Price."},"subtotal":{"type":"number","nullable":true,"description":"Subtotal."},"discount":{"type":"number","nullable":true,"description":"Discount."},"discountLabel":{"type":"string","description":"Discount Label."},"Description":{"type":"string","description":"Description."},"sku":{"type":"string","description":"Sku."},"originalPrice":{"type":"number","nullable":true,"description":"Original Price."}},"additionalProperties":{"nullable":true}},"description":"Items."},"Outlet":{"nullable":true,"description":"Outlet."},"Total":{"type":"number","nullable":true,"description":"Total."},"Payments":{"type":"array","items":{"nullable":true},"description":"Payments."},"Totals":{"type":"array","items":{"nullable":true},"description":"Totals."},"Change":{"type":"number","nullable":true,"description":"Change."},"Cashier":{"type":"string","description":"Cashier."},"Note":{"type":"string","description":"Note."},"Member":{"nullable":true,"description":"Member."},"CreatedByID":{"type":"string","description":"Created By ID."},"CreatedByName":{"type":"string","description":"Created By Name."}},"required":["InvoiceNumber","Items"],"additionalProperties":{"nullable":true},"description":"Invoice."}},"required":["Invoice"]},"VoidInvoiceSchema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Id UUID identifier."},"reason":{"type":"string","minLength":3,"maxLength":250,"description":"Reason. (min length 3, max length 250)"}},"required":["id"]},"InvoiceQuerySchema":{"type":"object","properties":{"Outlet":{"type":"string","description":"Outlet."},"Page":{"type":"number","minimum":1,"default":1,"description":"Page. (min 1)"},"Limit":{"type":"number","minimum":1,"maximum":100,"default":50,"description":"Limit. (min 1, max 100)"}}},"PosTabSchema":{"type":"object","properties":{"id":{"type":"string","description":"Id."},"tabName":{"type":"string","minLength":1,"description":"Tab Name. (min length 1)"},"tabOrder":{"type":"number","nullable":true,"description":"Tab Order."},"productIds":{"type":"array","items":{"type":"string"},"description":"Product Ids."}},"required":["tabName"]},"ProductQuerySchema":{"type":"object","properties":{"id":{"type":"string","description":"Id."},"query":{"type":"string","description":"Query."},"outlet":{"type":"string","nullable":true,"description":"Outlet."},"category":{"type":"string","nullable":true,"description":"Category."},"limit":{"type":"number","minimum":1,"maximum":100,"default":20,"description":"Limit. (min 1, max 100)"},"page":{"type":"number","minimum":1,"default":1,"description":"Page. (min 1)"},"ids":{"type":"array","items":{"type":"string"},"description":"Ids."}}},"ProductIdSchema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Id UUID identifier."}},"required":["id"]},"ProductVariantQuerySchema":{"type":"object","properties":{"query":{"type":"string","maxLength":100,"description":"Query. (max length 100)"},"status":{"type":"string","enum":["ALL","ACTIVE","INACTIVE"],"default":"ALL","description":"Status (ALL | ACTIVE | INACTIVE)."},"inventory":{"type":"string","enum":["ALL","TRACKED","UNTRACKED"],"default":"ALL","description":"Inventory (ALL | TRACKED | UNTRACKED)."},"category":{"type":"string","minLength":1,"maxLength":200,"description":"Category. (min length 1, max length 200)"},"brand":{"type":"string","minLength":1,"maxLength":100,"description":"Brand. (min length 1, max length 100)"},"supplier":{"type":"string","minLength":1,"maxLength":200,"description":"Supplier. (min length 1, max length 200)"},"type":{"type":"string","minLength":1,"maxLength":50,"description":"Type. (min length 1, max length 50)"},"outletId":{"type":"string","format":"uuid","description":"Outlet Id UUID identifier."},"orderBy":{"type":"string","enum":["NAME","CREATED"],"default":"NAME","description":"Order By (NAME | CREATED)."},"orderDirection":{"type":"string","enum":["ASC","DESC"],"default":"ASC","description":"Order Direction (ASC | DESC)."},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Limit. (min 1, max 100)"},"page":{"type":"integer","minimum":1,"default":1,"description":"Page. (min 1)"}}},"ProductCreateSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"description":"Name. (min length 1, max length 200)"},"code":{"type":"string","minLength":1,"maxLength":100,"description":"Code. (min length 1, max length 100)"},"category":{"type":"string","nullable":true,"maxLength":200,"description":"Category. (max length 200)"},"cost":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0,"description":"Cost. (min 0, max 999999999999)"},"price":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0,"description":"Price. (min 0, max 999999999999)"},"weight":{"type":"number","nullable":true,"minimum":0,"maximum":999999999,"default":0,"description":"Weight. (min 0, max 999999999)"},"uom":{"type":"string","minLength":1,"maxLength":50,"default":"Pcs","description":"Uom. (min length 1, max length 50)"},"pricingType":{"type":"string","enum":["Single","Multiple"],"default":"Single","description":"Pricing Type (Single | Multiple)."},"type":{"type":"string","enum":["Standard","Non-Inventory","Composite","Batch Number","Manufactured","Serialized"],"default":"Standard","description":"Type (Standard | Non-Inventory | Composite | Batch Number | Manufactured | Serialized)."},"brand":{"type":"string","nullable":true,"maxLength":100,"description":"Brand. (max length 100)"},"supplier":{"type":"string","nullable":true,"maxLength":200,"description":"Supplier. (max length 200)"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"maxItems":20,"default":[],"description":"Tags."},"imageUrl":{"anyOf":[{"type":"string","maxLength":2796331},{"type":"string","enum":[""]},{"nullable":true}],"description":"Image Url."},"images":{"type":"array","items":{"type":"string","maxLength":2796331},"maxItems":5,"default":[],"description":"Images."},"isActive":{"type":"boolean","default":true,"description":"Boolean flag for is active."},"description":{"type":"string","nullable":true,"maxLength":3000,"description":"Description. (max length 3000)"},"storage":{"type":"string","nullable":true,"maxLength":200,"description":"Storage. (max length 200)"},"barcode":{"type":"string","nullable":true,"maxLength":100,"description":"Barcode. (max length 100)"},"trackInventory":{"type":"boolean","default":false,"description":"Boolean flag for track inventory."},"outlet":{"type":"string","nullable":true,"maxLength":100,"description":"Outlet. (max length 100)"},"variantMode":{"type":"string","enum":["SINGLE","MULTIPLE"],"description":"Variant Mode (SINGLE | MULTIPLE)."},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true,"format":"uuid","description":"Id UUID identifier."},"name":{"type":"string","minLength":1,"maxLength":100,"description":"Name. (min length 1, max length 100)"},"code":{"type":"string","minLength":1,"maxLength":100,"description":"Code. (min length 1, max length 100)"},"barcode":{"type":"string","nullable":true,"maxLength":100,"description":"Barcode. (max length 100)"},"cost":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0,"description":"Cost. (min 0, max 999999999999)"},"price":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0,"description":"Price. (min 0, max 999999999999)"},"weight":{"type":"number","nullable":true,"minimum":0,"maximum":999999999,"default":0,"description":"Weight. (min 0, max 999999999)"},"uom":{"type":"string","minLength":1,"maxLength":50,"default":"Pcs","description":"Uom. (min length 1, max length 50)"},"isDefault":{"type":"boolean","default":false,"description":"Boolean flag for is default."},"isActive":{"type":"boolean","default":true,"description":"Boolean flag for is active."},"sortOrder":{"type":"integer","nullable":true,"minimum":0,"maximum":99,"description":"Sort Order. (min 0, max 99)"}},"required":["name","code"]},"minItems":1,"maxItems":100,"description":"Variants."}},"required":["name","code"]},"ProductUpdateRequestSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"description":"Name. (min length 1, max length 200)"},"code":{"type":"string","minLength":1,"maxLength":100,"description":"Code. (min length 1, max length 100)"},"category":{"type":"string","nullable":true,"maxLength":200,"description":"Category. (max length 200)"},"cost":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0,"description":"Cost. (min 0, max 999999999999)"},"price":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0,"description":"Price. (min 0, max 999999999999)"},"weight":{"type":"number","nullable":true,"minimum":0,"maximum":999999999,"default":0,"description":"Weight. (min 0, max 999999999)"},"uom":{"type":"string","minLength":1,"maxLength":50,"default":"Pcs","description":"Uom. (min length 1, max length 50)"},"pricingType":{"type":"string","enum":["Single","Multiple"],"default":"Single","description":"Pricing Type (Single | Multiple)."},"type":{"type":"string","enum":["Standard","Non-Inventory","Composite","Batch Number","Manufactured","Serialized"],"default":"Standard","description":"Type (Standard | Non-Inventory | Composite | Batch Number | Manufactured | Serialized)."},"brand":{"type":"string","nullable":true,"maxLength":100,"description":"Brand. (max length 100)"},"supplier":{"type":"string","nullable":true,"maxLength":200,"description":"Supplier. (max length 200)"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"maxItems":20,"default":[],"description":"Tags."},"imageUrl":{"anyOf":[{"type":"string","maxLength":2796331},{"type":"string","enum":[""]},{"nullable":true}],"description":"Image Url."},"images":{"type":"array","items":{"type":"string","maxLength":2796331},"maxItems":5,"default":[],"description":"Images."},"isActive":{"type":"boolean","default":true,"description":"Boolean flag for is active."},"description":{"type":"string","nullable":true,"maxLength":3000,"description":"Description. (max length 3000)"},"storage":{"type":"string","nullable":true,"maxLength":200,"description":"Storage. (max length 200)"},"barcode":{"type":"string","nullable":true,"maxLength":100,"description":"Barcode. (max length 100)"},"trackInventory":{"type":"boolean","default":false,"description":"Boolean flag for track inventory."},"outlet":{"type":"string","nullable":true,"maxLength":100,"description":"Outlet. (max length 100)"},"variantMode":{"type":"string","enum":["SINGLE","MULTIPLE"],"description":"Variant Mode (SINGLE | MULTIPLE)."},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true,"format":"uuid","description":"Id UUID identifier."},"name":{"type":"string","minLength":1,"maxLength":100,"description":"Name. (min length 1, max length 100)"},"code":{"type":"string","minLength":1,"maxLength":100,"description":"Code. (min length 1, max length 100)"},"barcode":{"type":"string","nullable":true,"maxLength":100,"description":"Barcode. (max length 100)"},"cost":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0,"description":"Cost. (min 0, max 999999999999)"},"price":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0,"description":"Price. (min 0, max 999999999999)"},"weight":{"type":"number","nullable":true,"minimum":0,"maximum":999999999,"default":0,"description":"Weight. (min 0, max 999999999)"},"uom":{"type":"string","minLength":1,"maxLength":50,"default":"Pcs","description":"Uom. (min length 1, max length 50)"},"isDefault":{"type":"boolean","default":false,"description":"Boolean flag for is default."},"isActive":{"type":"boolean","default":true,"description":"Boolean flag for is active."},"sortOrder":{"type":"integer","nullable":true,"minimum":0,"maximum":99,"description":"Sort Order. (min 0, max 99)"}},"required":["name","code"]},"minItems":1,"maxItems":100,"description":"Variants."},"id":{"type":"string","format":"uuid","description":"Id UUID identifier."}},"required":["name","code","id"]},"ProductFormRequestSchema":{"type":"object","properties":{"id":{"type":"string","nullable":true,"format":"uuid","description":"Id UUID identifier."},"option":{"type":"string","enum":["category","brand","supplier","storage"],"description":"Option (category | brand | supplier | storage)."}}},"ProductVariantUniquenessRequestSchema":{"type":"object","properties":{"productId":{"type":"string","nullable":true,"format":"uuid","description":"Product Id UUID identifier."},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true,"format":"uuid","description":"Id UUID identifier."},"name":{"type":"string","minLength":1,"maxLength":100,"description":"Name. (min length 1, max length 100)"},"code":{"type":"string","minLength":1,"maxLength":100,"description":"Code. (min length 1, max length 100)"},"barcode":{"type":"string","nullable":true,"maxLength":100,"description":"Barcode. (max length 100)"}},"required":["name","code"]},"minItems":1,"maxItems":100,"description":"Variants."}},"required":["variants"]},"ProductIdListSchema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100,"description":"Ids."}},"required":["ids"]},"ProductPermanentDeleteSchema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Id UUID identifier."},"confirmation":{"type":"string","enum":["DELETE"],"description":"Confirmation (DELETE)."}},"required":["id","confirmation"]},"CategoryUpdateSchema":{"type":"object","properties":{"sourceKey":{"type":"string","minLength":1,"maxLength":200,"description":"Source Key. (min length 1, max length 200)"},"targetKey":{"type":"string","nullable":true,"maxLength":200,"description":"Target Key. (max length 200)"}},"required":["sourceKey"]},"ProductTagOptionsRequestSchema":{"type":"object","properties":{"query":{"type":"string","maxLength":100,"description":"Query. (max length 100)"},"limit":{"type":"integer","minimum":1,"maximum":100,"default":50,"description":"Limit. (min 1, max 100)"}}},"BrandCreateSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Name. (min length 1, max length 100)"},"description":{"type":"string","nullable":true,"maxLength":500,"description":"Description. (max length 500)"}},"required":["name"]},"SupplierCreateSchema":{"type":"object","properties":{"code":{"type":"string","nullable":true,"maxLength":50,"description":"Code. (max length 50)"},"name":{"type":"string","minLength":1,"maxLength":200,"description":"Name. (min length 1, max length 200)"},"firstName":{"type":"string","nullable":true,"maxLength":100,"description":"First Name. (max length 100)"},"lastName":{"type":"string","nullable":true,"maxLength":100,"description":"Last Name. (max length 100)"},"email":{"anyOf":[{"type":"string","maxLength":254,"format":"email"},{"type":"string","enum":[""]},{"nullable":true}],"description":"Email."},"phone":{"type":"string","nullable":true,"maxLength":50,"description":"Phone. (max length 50)"},"mobile":{"type":"string","nullable":true,"maxLength":50,"description":"Mobile. (max length 50)"},"address":{"type":"string","nullable":true,"maxLength":500,"description":"Address. (max length 500)"},"city":{"type":"string","nullable":true,"maxLength":100,"description":"City. (max length 100)"},"state":{"type":"string","nullable":true,"maxLength":100,"description":"State. (max length 100)"},"zipCode":{"type":"string","nullable":true,"maxLength":20,"description":"Zip Code. (max length 20)"},"country":{"type":"string","nullable":true,"maxLength":100,"description":"Country. (max length 100)"},"gender":{"type":"string","nullable":true,"maxLength":30,"description":"Gender. (max length 30)"},"group":{"type":"string","nullable":true,"maxLength":100,"description":"Group. (max length 100)"},"imageUrl":{"anyOf":[{"type":"string","maxLength":2048,"format":"uri"},{"type":"string","enum":[""]},{"nullable":true}],"description":"Image Url."},"notes":{"type":"string","nullable":true,"maxLength":2000,"description":"Notes. (max length 2000)"},"status":{"type":"string","enum":["Active","Inactive","Suspended"],"default":"Active","description":"Status (Active | Inactive | Suspended)."}},"required":["name"]},"TagCreateSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50,"description":"Name. (min length 1, max length 50)"}},"required":["name"]},"OutletQuerySchema":{"type":"object","properties":{"id":{"type":"string","description":"Id."},"query":{"type":"string","description":"Query."},"limit":{"type":"number","minimum":1,"maximum":1000,"default":20,"description":"Limit. (min 1, max 1000)"},"page":{"type":"number","minimum":1,"default":1,"description":"Page. (min 1)"}}},"OutletCreateSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Name. (min length 1)"},"code":{"type":"string","minLength":1,"description":"Code. (min length 1)"},"title":{"type":"string","nullable":true,"description":"Title."},"cashier":{"type":"string","nullable":true,"description":"Cashier."},"address":{"type":"string","nullable":true,"description":"Address."},"phone":{"type":"string","nullable":true,"description":"Phone."},"whatsapp":{"type":"string","nullable":true,"description":"Whatsapp."}},"required":["name","code"]},"OutletUpdateRequestSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Name. (min length 1)"},"code":{"type":"string","minLength":1,"description":"Code. (min length 1)"},"title":{"type":"string","nullable":true,"description":"Title."},"cashier":{"type":"string","nullable":true,"description":"Cashier."},"address":{"type":"string","nullable":true,"description":"Address."},"phone":{"type":"string","nullable":true,"description":"Phone."},"whatsapp":{"type":"string","nullable":true,"description":"Whatsapp."},"id":{"type":"string","format":"uuid","description":"Id UUID identifier."}},"required":["name","code","id"]},"OutletIdListSchema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100,"description":"Ids."}},"required":["ids"]},"InventoryQuerySchema":{"type":"object","properties":{"outletId":{"type":"string","format":"uuid","description":"Outlet Id UUID identifier."},"category":{"type":"string","description":"Category."},"query":{"type":"string","maxLength":100,"description":"Query. (max length 100)"},"page":{"type":"integer","minimum":1,"default":1,"description":"Page. (min 1)"},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Limit. (min 1, max 100)"}}},"InventoryMovementQuerySchema":{"type":"object","properties":{"outletId":{"type":"string","format":"uuid","description":"Outlet Id UUID identifier."},"type":{"type":"string","enum":["SET","ADJUSTMENT_IN","ADJUSTMENT_OUT","INVOICE_SALE","INVOICE_VOID"],"description":"Type (SET | ADJUSTMENT_IN | ADJUSTMENT_OUT | INVOICE_SALE | INVOICE_VOID)."},"query":{"type":"string","maxLength":100,"description":"Query. (max length 100)"},"from":{"type":"string","format":"date-time","description":"From ISO 8601 date-time string."},"to":{"type":"string","format":"date-time","description":"To ISO 8601 date-time string."},"page":{"type":"integer","minimum":1,"default":1,"description":"Page. (min 1)"},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Limit. (min 1, max 100)"}}},"InventoryAdjustmentSchema":{"type":"object","properties":{"outletId":{"type":"string","format":"uuid","description":"Outlet Id UUID identifier."},"productId":{"type":"string","format":"uuid","description":"Product Id UUID identifier."},"variantId":{"type":"string","format":"uuid","description":"Variant Id UUID identifier."},"operation":{"type":"string","enum":["SET","IN","OUT"],"description":"Operation (SET | IN | OUT)."},"quantity":{"type":"integer","nullable":true,"minimum":0,"maximum":1000000,"description":"Quantity. (min 0, max 1000000)"},"minimumStock":{"type":"integer","nullable":true,"minimum":0,"maximum":1000000,"description":"Minimum Stock. (min 0, max 1000000)"},"reason":{"type":"string","minLength":3,"maxLength":250,"description":"Reason. (min length 3, max length 250)"},"idempotencyKey":{"type":"string","format":"uuid","description":"Idempotency Key UUID identifier."}},"required":["outletId","productId","operation","quantity","reason","idempotencyKey"]},"FilterOptionQuerySchema":{"type":"object","properties":{"query":{"type":"string","maxLength":100,"description":"Query. (max length 100)"}}},"PromotionQuerySchema":{"type":"object","properties":{"id":{"type":"string","description":"Id."},"query":{"type":"string","description":"Query."},"productIds":{"type":"string","description":"Product Ids."},"productCode":{"type":"string","description":"Product Code."},"category":{"type":"string","description":"Category."},"isActive":{"type":"boolean","nullable":true,"description":"Boolean flag for is active."},"limit":{"type":"number","minimum":1,"maximum":100,"default":20,"description":"Limit. (min 1, max 100)"},"page":{"type":"number","minimum":1,"default":1,"description":"Page. (min 1)"}}},"PromotionCreateSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Name. (min length 1)"},"type":{"type":"string","minLength":1,"description":"Type. (min length 1)"},"value":{"type":"number","nullable":true,"description":"Value."},"description":{"type":"string","nullable":true,"description":"Description."},"displayStyle":{"type":"string","nullable":true,"description":"Display Style."},"productIds":{"type":"array","nullable":true,"items":{"type":"string","format":"uuid"},"maxItems":1000,"description":"Product Ids."},"categories":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Categories."},"isActive":{"type":"boolean","default":true,"description":"Boolean flag for is active."},"minQuantity":{"type":"integer","nullable":true,"minimum":1,"description":"Min Quantity. (min 1)"},"tiers":{"nullable":true,"description":"Tiers."}},"required":["name","type","value"]},"PromotionUpdateRequestSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Name. (min length 1)"},"type":{"type":"string","minLength":1,"description":"Type. (min length 1)"},"value":{"type":"number","nullable":true,"description":"Value."},"description":{"type":"string","nullable":true,"description":"Description."},"displayStyle":{"type":"string","nullable":true,"description":"Display Style."},"productIds":{"type":"array","nullable":true,"items":{"type":"string","format":"uuid"},"maxItems":1000,"description":"Product Ids."},"categories":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Categories."},"isActive":{"type":"boolean","default":true,"description":"Boolean flag for is active."},"minQuantity":{"type":"integer","nullable":true,"minimum":1,"description":"Min Quantity. (min 1)"},"tiers":{"nullable":true,"description":"Tiers."},"id":{"type":"string","format":"uuid","description":"Id UUID identifier."}},"required":["id"]},"PromotionIdListSchema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100,"description":"Ids."}},"required":["ids"]},"ContactQuerySchema":{"type":"object","properties":{"query":{"type":"string","description":"Query."},"status":{"type":"string","description":"Status."},"group":{"type":"string","description":"Group."},"page":{"type":"number","minimum":1,"default":1,"description":"Page. (min 1)"},"limit":{"type":"number","minimum":1,"maximum":100,"default":20,"description":"Limit. (min 1, max 100)"}}},"ContactIdSchema":{"type":"object","properties":{"id":{"type":"string","minLength":1,"description":"Id. (min length 1)"}},"required":["id"]},"ContactCreateSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"description":"Name. (min length 1, max length 200)"},"code":{"type":"string","minLength":1,"maxLength":100,"description":"Code. (min length 1, max length 100)"},"firstName":{"type":"string","nullable":true,"maxLength":100,"description":"First Name. (max length 100)"},"lastName":{"type":"string","nullable":true,"maxLength":100,"description":"Last Name. (max length 100)"},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"string","enum":[""]},{"nullable":true}],"description":"Email."},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"string","enum":[""]},{"nullable":true}],"description":"Phone."},"mobile":{"anyOf":[{"type":"string","maxLength":50},{"type":"string","enum":[""]},{"nullable":true}],"description":"Mobile."},"address":{"anyOf":[{"type":"string","maxLength":500},{"type":"string","enum":[""]},{"nullable":true}],"description":"Address."},"city":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}],"description":"City."},"state":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}],"description":"State."},"zipCode":{"anyOf":[{"type":"string","maxLength":20},{"type":"string","enum":[""]},{"nullable":true}],"description":"Zip Code."},"country":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}],"description":"Country."},"gender":{"anyOf":[{"type":"string","maxLength":20},{"type":"string","enum":[""]},{"nullable":true}],"description":"Gender."},"group":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}],"description":"Group."},"notes":{"anyOf":[{"type":"string","maxLength":1000},{"type":"string","enum":[""]},{"nullable":true}],"description":"Notes."},"status":{"type":"string","enum":["Active","Inactive"],"default":"Active","description":"Status (Active | Inactive)."}},"required":["name","code"]},"ContactUpdateSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"description":"Name. (min length 1, max length 200)"},"code":{"type":"string","minLength":1,"maxLength":100,"description":"Code. (min length 1, max length 100)"},"firstName":{"type":"string","nullable":true,"maxLength":100,"description":"First Name. (max length 100)"},"lastName":{"type":"string","nullable":true,"maxLength":100,"description":"Last Name. (max length 100)"},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"string","enum":[""]},{"nullable":true}],"description":"Email."},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"string","enum":[""]},{"nullable":true}],"description":"Phone."},"mobile":{"anyOf":[{"type":"string","maxLength":50},{"type":"string","enum":[""]},{"nullable":true}],"description":"Mobile."},"address":{"anyOf":[{"type":"string","maxLength":500},{"type":"string","enum":[""]},{"nullable":true}],"description":"Address."},"city":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}],"description":"City."},"state":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}],"description":"State."},"zipCode":{"anyOf":[{"type":"string","maxLength":20},{"type":"string","enum":[""]},{"nullable":true}],"description":"Zip Code."},"country":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}],"description":"Country."},"gender":{"anyOf":[{"type":"string","maxLength":20},{"type":"string","enum":[""]},{"nullable":true}],"description":"Gender."},"group":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}],"description":"Group."},"notes":{"anyOf":[{"type":"string","maxLength":1000},{"type":"string","enum":[""]},{"nullable":true}],"description":"Notes."},"status":{"type":"string","enum":["Active","Inactive"],"default":"Active","description":"Status (Active | Inactive)."},"id":{"type":"string","minLength":1,"description":"Id. (min length 1)"}},"required":["name","code","id"]},"ContactDeleteSchema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":100,"description":"Ids."}},"required":["ids"]},"RealtimeReportFilterSchema":{"type":"object","properties":{"startDate":{"type":"string","format":"date-time","description":"Start Date ISO 8601 date-time string."},"endDate":{"type":"string","format":"date-time","description":"End Date ISO 8601 date-time string."},"outletId":{"type":"string","format":"uuid","description":"Outlet Id UUID identifier."},"outlet":{"type":"string","maxLength":200,"description":"Outlet. (max length 200)"},"category":{"type":"string","maxLength":200,"description":"Category. (max length 200)"},"query":{"type":"string","maxLength":200,"description":"Query. (max length 200)"},"pageIndex":{"type":"integer","nullable":true,"minimum":0,"default":0,"description":"Page Index. (min 0)"},"pageSize":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Page Size. (min 1, max 100)"}}},"UserQuerySchema":{"type":"object","properties":{"query":{"type":"string","description":"Query."},"status":{"type":"string","description":"Status."},"isActive":{"type":"boolean","nullable":true,"description":"Boolean flag for is active."},"limit":{"type":"integer","minimum":1,"maximum":100,"default":50,"description":"Limit. (min 1, max 100)"},"page":{"type":"integer","minimum":1,"default":1,"description":"Page. (min 1)"}}},"UserCreateSchema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"Email email address."},"username":{"type":"string","nullable":true,"minLength":1,"maxLength":100,"description":"Username. (min length 1, max length 100)"},"name":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Name. (min length 1, max length 200)"},"phone":{"type":"string","nullable":true,"maxLength":30,"description":"Phone. (max length 30)"},"status":{"type":"string","enum":["pending","approved","rejected"],"description":"Status (pending | approved | rejected)."},"isActive":{"type":"boolean","description":"Boolean flag for is active."},"roleId":{"type":"string","format":"uuid","description":"Role Id UUID identifier."},"userGroupId":{"type":"string","nullable":true,"format":"uuid","description":"User Group Id UUID identifier."},"outletIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":1000,"description":"Outlet Ids."},"password":{"type":"string","minLength":6,"description":"Password. (min length 6)"}},"required":["email","roleId","password"]},"UserUpdateRequestSchema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"Email email address."},"username":{"type":"string","nullable":true,"minLength":1,"maxLength":100,"description":"Username. (min length 1, max length 100)"},"name":{"type":"string","nullable":true,"minLength":1,"maxLength":200,"description":"Name. (min length 1, max length 200)"},"phone":{"type":"string","nullable":true,"maxLength":30,"description":"Phone. (max length 30)"},"status":{"type":"string","enum":["pending","approved","rejected"],"description":"Status (pending | approved | rejected)."},"isActive":{"type":"boolean","description":"Boolean flag for is active."},"roleId":{"type":"string","nullable":true,"format":"uuid","description":"Role Id UUID identifier."},"userGroupId":{"type":"string","nullable":true,"format":"uuid","description":"User Group Id UUID identifier."},"outletIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":1000,"description":"Outlet Ids."},"password":{"type":"string","minLength":6,"description":"Password. (min length 6)"},"id":{"type":"string","format":"uuid","description":"Id UUID identifier."}},"required":["id"]},"UserStatusRequestSchema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Id UUID identifier."},"isActive":{"type":"boolean","description":"Boolean flag for is active."}},"required":["id","isActive"]},"UserIdListSchema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100,"description":"Ids."}},"required":["ids"]},"RoleListSchema":{"type":"object","properties":{"query":{"type":"string","description":"Query."},"limit":{"type":"number","minimum":1,"maximum":100,"default":100,"description":"Limit. (min 1, max 100)"},"page":{"type":"number","minimum":1,"default":1,"description":"Page. (min 1)"}}},"RoleSaveSchema":{"type":"object","properties":{"ID":{"type":"string","description":"ID."},"id":{"type":"string","description":"Id."},"name":{"type":"string","minLength":1,"description":"Name. (min length 1)"},"dataScope":{"type":"string","enum":["all","own"],"default":"all","description":"Data Scope (all | own)."},"scopedModules":{"type":"string","default":"","description":"Scoped Modules."},"permissions":{"type":"array","items":{"type":"object","properties":{"module":{"type":"string","enum":["dashboard","product","inventory","invoice","outlet","promotion","settings","users","roles","user_groups","reports","contact","integrations"],"description":"Module (dashboard | product | inventory | invoice | outlet | promotion | settings | users | roles | user_groups | reports | contact | integrations)."},"action":{"type":"string","enum":["view","create","update","delete","archive","view_list","view_detail"],"description":"Action (view | create | update | delete | archive | view_list | view_detail)."}},"required":["module","action"]},"description":"Permissions."}},"required":["name","permissions"]},"RoleUpdateRequestSchema":{"type":"object","properties":{"ID":{"type":"string","description":"ID."},"id":{"type":"string","format":"uuid","description":"Id UUID identifier."},"name":{"type":"string","minLength":1,"description":"Name. (min length 1)"},"dataScope":{"type":"string","enum":["all","own"],"default":"all","description":"Data Scope (all | own)."},"scopedModules":{"type":"string","default":"","description":"Scoped Modules."},"permissions":{"type":"array","items":{"type":"object","properties":{"module":{"type":"string","enum":["dashboard","product","inventory","invoice","outlet","promotion","settings","users","roles","user_groups","reports","contact","integrations"],"description":"Module (dashboard | product | inventory | invoice | outlet | promotion | settings | users | roles | user_groups | reports | contact | integrations)."},"action":{"type":"string","enum":["view","create","update","delete","archive","view_list","view_detail"],"description":"Action (view | create | update | delete | archive | view_list | view_detail)."}},"required":["module","action"]},"description":"Permissions."}},"required":["id","name","permissions"]},"RoleIdListSchema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100,"description":"Ids."}},"required":["ids"]},"UserGroupListSchema":{"type":"object","properties":{"query":{"type":"string","description":"Query."},"limit":{"type":"number","minimum":1,"maximum":100,"default":100,"description":"Limit. (min 1, max 100)"},"page":{"type":"number","minimum":1,"default":1,"description":"Page. (min 1)"}}},"UserGroupCreateSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":150,"description":"Name. (min length 1, max length 150)"},"description":{"type":"string","nullable":true,"maxLength":500,"description":"Description. (max length 500)"},"outletIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":1000,"description":"Outlet Ids."},"dataScope":{"type":"string","enum":["all","restricted"],"default":"restricted","description":"Data Scope (all | restricted)."},"scopedModules":{"type":"string","maxLength":500,"default":"","description":"Scoped Modules. (max length 500)"},"memberUserIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":500,"description":"Member User Ids."}},"required":["name"]},"UserGroupUpdateRequestSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":150,"description":"Name. (min length 1, max length 150)"},"description":{"type":"string","nullable":true,"maxLength":500,"description":"Description. (max length 500)"},"outletIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":1000,"description":"Outlet Ids."},"dataScope":{"type":"string","enum":["all","restricted"],"default":"restricted","description":"Data Scope (all | restricted)."},"scopedModules":{"type":"string","maxLength":500,"default":"","description":"Scoped Modules. (max length 500)"},"id":{"type":"string","format":"uuid","description":"Id UUID identifier."}},"required":["id"]},"UserGroupIdListSchema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100,"description":"Ids."}},"required":["ids"]},"OAuthTokenExchangeSchema":{"type":"object","properties":{"client_id":{"type":"string","minLength":1,"maxLength":128,"description":"Client Id. (min length 1, max length 128)"},"client_secret":{"type":"string","minLength":1,"maxLength":256,"description":"Client Secret. (min length 1, max length 256)"},"grant_type":{"type":"string","enum":["client_credentials"],"default":"client_credentials","description":"Grant Type (client_credentials)."},"scope":{"type":"string","maxLength":1000,"description":"Scope. (max length 1000)"}},"required":["client_id","client_secret"]},"CreateIntegrationTokenSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Name. (min length 1, max length 100)"},"scopes":{"type":"array","items":{"type":"string","enum":["invoice.create","invoice.view","invoice.delete","outlet.view","product.view","inventory.view","inventory.update","reports.view","dashboard.view","promotion.view","contact.view","users.view"]},"minItems":1,"default":["invoice.create","invoice.view","outlet.view","product.view"],"description":"Scopes."},"expiresInDays":{"anyOf":[{"type":"integer","minimum":1,"maximum":365},{"nullable":true}],"description":"Expires In Days."}},"required":["name"]},"RevokeIntegrationTokenSchema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Id UUID identifier."}},"required":["id"]},"CreateOAuthClientSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Name. (min length 1, max length 100)"},"scopes":{"type":"array","items":{"type":"string","enum":["invoice.create","invoice.view","invoice.delete","outlet.view","product.view","inventory.view","inventory.update","reports.view","dashboard.view","promotion.view","contact.view","users.view"]},"minItems":1,"default":["invoice.create","invoice.view","outlet.view","product.view"],"description":"Scopes."},"rateLimitPerMin":{"type":"integer","minimum":30,"maximum":1200,"default":240,"description":"Rate Limit Per Min. (min 30, max 1200)"},"tokenTtlSeconds":{"type":"integer","minimum":300,"maximum":86400,"default":3600,"description":"Token Ttl Seconds. (min 300, max 86400)"}},"required":["name"]},"OAuthClientIdSchema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Id UUID identifier."}},"required":["id"]},"CreateWebhookSchema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Name. (min length 1, max length 100)"},"url":{"type":"string","maxLength":500,"format":"uri","description":"Url HTTPS/HTTP URL. (max length 500)"},"events":{"type":"array","items":{"type":"string","enum":["invoice.created","invoice.voided","product.created","product.updated","inventory.adjusted","outlet.created"]},"minItems":1,"description":"Events."},"logMode":{"type":"string","enum":["Full","Error","None"],"default":"Full","description":"Log Mode (Full | Error | None)."},"customUserAgent":{"type":"string","nullable":true,"maxLength":120,"description":"Custom User Agent. (max length 120)"},"maxRetries":{"type":"integer","nullable":true,"minimum":0,"maximum":3,"default":1,"description":"Max Retries. (min 0, max 3)"}},"required":["name","url","events"]},"UpdateWebhookSchema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Id UUID identifier."},"name":{"type":"string","minLength":1,"maxLength":100,"description":"Name. (min length 1, max length 100)"},"url":{"type":"string","maxLength":500,"format":"uri","description":"Url HTTPS/HTTP URL. (max length 500)"},"events":{"type":"array","items":{"type":"string","enum":["invoice.created","invoice.voided","product.created","product.updated","inventory.adjusted","outlet.created"]},"minItems":1,"description":"Events."},"logMode":{"type":"string","enum":["Full","Error","None"],"description":"Log Mode (Full | Error | None)."},"customUserAgent":{"type":"string","nullable":true,"maxLength":120,"description":"Custom User Agent. (max length 120)"},"maxRetries":{"type":"integer","nullable":true,"minimum":0,"maximum":3,"description":"Max Retries. (min 0, max 3)"},"isActive":{"type":"boolean","description":"Boolean flag for is active."},"rotateSecret":{"type":"boolean","description":"Boolean flag for rotate secret."}},"required":["id"]},"WebhookIdSchema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Id UUID identifier."}},"required":["id"]},"WebhookDeliveryQuerySchema":{"type":"object","properties":{"subscriptionId":{"type":"string","format":"uuid","description":"Subscription Id UUID identifier."},"event":{"type":"string","maxLength":64,"description":"Event. (max length 64)"},"status":{"type":"string","enum":["success","failed"],"description":"Status (success | failed)."},"limit":{"type":"integer","minimum":1,"maximum":100,"default":30,"description":"Limit. (min 1, max 100)"}}},"AuditLogQuerySchema":{"type":"object","properties":{"event":{"type":"string","maxLength":80,"description":"Event. (max length 80)"},"outcome":{"type":"string","enum":["success","denied","failure"],"description":"Outcome (success | denied | failure)."},"limit":{"type":"integer","minimum":1,"maximum":200,"default":50,"description":"Limit. (min 1, max 200)"}}},"IntegrationDashboardQuerySchema":{"type":"object","properties":{"category":{"type":"string","enum":["agent-token","oauth","webhooks","deliveries","security-audit"],"description":"Category (agent-token | oauth | webhooks | deliveries | security-audit)."},"status":{"type":"string","enum":["success","denied","failure","info"],"description":"Status (success | denied | failure | info)."},"limit":{"type":"integer","minimum":1,"maximum":200,"default":100,"description":"Limit. (min 1, max 200)"}}},"PlatformTenantListRequest":{"type":"object","properties":{"search":{"type":"string","maxLength":120,"description":"Search by store name, subdomain, city, or owner email.","example":"toko"},"status":{"type":"string","enum":["all","active","suspended"],"default":"all","description":"Filter workspaces by operational status.","example":"all"},"plan":{"type":"string","enum":["all","basic","starter","pro","enterprise"],"default":"all","description":"Filter workspaces by subscription plan.","example":"all"},"page":{"type":"integer","minimum":1,"maximum":1000,"default":1,"example":1,"description":"Page. (min 1, max 1000)"},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20,"example":20,"description":"Limit. (min 1, max 100)"}}},"PlatformTenantUpdateRequest":{"type":"object","properties":{"tenantId":{"type":"string","format":"uuid","description":"Target tenant workspace UUID.","example":"11111111-1111-4111-8111-111111111111"},"status":{"type":"string","enum":["active","suspended"],"description":"Operational tenant status (active or suspended).","example":"active"},"plan":{"type":"string","enum":["basic","starter","pro","enterprise"],"description":"Workspace subscription plan tier.","example":"pro"},"customDomain":{"type":"string","nullable":true,"maxLength":255,"pattern":"^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,}$","description":"Optional custom white-label hostname or null to clear.","example":"pos.tokobuah.com"}},"required":["tenantId"]},"LoginRequest":{"type":"object","properties":{"email":{"type":"string","description":"Registered email address (optional if username is provided).","example":"owner@company.com"},"username":{"type":"string","description":"Registered username (used when email is omitted).","example":"owner"},"password":{"type":"string","minLength":1,"description":"Account password.","example":"••••••••"}},"required":["password"]},"RefreshTokenRequest":{"type":"object","properties":{"refreshToken":{"type":"string","minLength":1,"description":"Supabase refresh token obtained from login or prior refresh.","example":"v1.MRmO7x..."}},"required":["refreshToken"]},"RegisterRequest":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":120,"description":"Store owner display name.","example":"Budi Santoso"},"email":{"type":"string","maxLength":255,"format":"email","description":"Owner email address used for authentication.","example":"owner@tokobuah.com"},"phone":{"type":"string","minLength":9,"maxLength":20,"description":"Active owner phone or WhatsApp number.","example":"081234567890"},"storeName":{"type":"string","minLength":2,"maxLength":120,"description":"Primary business or store display name.","example":"Toko Buah Segar"},"subdomain":{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{1,30}[a-z0-9])$","description":"Unique lowercase tenant subdomain slug.","example":"toko-buah-segar"},"city":{"type":"string","minLength":2,"maxLength":100,"description":"City or business region.","example":"Jakarta Selatan"},"businessCategory":{"type":"string","enum":["retail","fnb","fashion","electronics","wholesale","services"],"description":"Primary business vertical.","example":"retail"},"plannedOutlets":{"type":"string","enum":["1","2","3","4","5+"],"description":"Initial planned outlet count bracket.","example":"1"},"password":{"type":"string","minLength":8,"maxLength":128,"description":"Account password (minimum 8 characters).","example":"SecurePass123!"},"note":{"type":"string","nullable":true,"maxLength":500,"description":"Optional store setup context note.","example":"Main store opening setup"},"verificationMethod":{"type":"string","enum":["direct","otp","activation"],"default":"direct","description":"Selected onboarding flow.","example":"direct"}},"required":["name","email","phone","storeName","subdomain","city","businessCategory","plannedOutlets","password"]},"ProfileUpdateRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Updated display name.","example":"Budi Santoso"},"username":{"type":"string","minLength":1,"description":"Updated unique username.","example":"budi.santoso"},"currentPassword":{"type":"string","description":"Optional current password verification field.","example":"OldPassword123!"},"newPassword":{"type":"string","nullable":true,"minLength":6,"description":"New password (minimum 6 characters).","example":"NewSecurePass123!"}}},"AuthorizeRouteRequest":{"type":"object","properties":{"pathname":{"type":"string","maxLength":256,"description":"Menu pathname starting with /menu.","example":"/menu/invoices"}},"required":["pathname"]},"ForceSyncRequest":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"Target user email within the active tenant whose auth metadata will be resynchronized.","example":"cashier@invoger.com"}},"required":["email"]},"InvoiceDetailRequest":{"type":"object","properties":{"id":{"type":"string","description":"Invoice UUID.","example":"inv_123456"},"invoiceNumber":{"type":"string","description":"Full invoice number (e.g., SO-01.26.11.0001).","example":"SO-01.26.11.0001"},"FullInvoiceNumber":{"type":"string","description":"Legacy PascalCase full invoice number.","example":"SO-01.26.11.0001"},"number":{"type":"string","description":"Invoice number alias.","example":"SO-01.26.11.0001"}}},"InvoiceOutletQuery":{"type":"object","properties":{"query":{"type":"string","maxLength":100,"description":"Search term matching outlet name or code.","example":"Senopati"},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Maximum number of outlets to return.","example":20}}},"InvoiceProductQuery":{"type":"object","properties":{"query":{"type":"string","maxLength":100,"description":"Search term matching product name, SKU, or barcode.","example":"Coffee"},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20,"description":"Maximum number of products to return.","example":20},"outletId":{"type":"string","format":"uuid","description":"Active POS outlet UUID for stock and availability resolution.","example":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"}},"required":["outletId"]},"InvoicePromotionQuery":{"type":"object","properties":{"code":{"type":"string","description":"Product code filter alias.","example":"COF-01"},"ProductCode":{"type":"string","description":"PascalCase product code filter.","example":"COF-01"},"productCode":{"type":"string","description":"CamelCase product code filter.","example":"COF-01"},"IsActive":{"type":"boolean","description":"PascalCase active status filter.","example":true},"isActive":{"type":"boolean","description":"CamelCase active status filter.","example":true},"Limit":{"type":"integer","minimum":1,"maximum":100,"description":"PascalCase result limit.","example":20},"limit":{"type":"integer","minimum":1,"maximum":100,"description":"CamelCase result limit.","example":20}}},"RandomProductRequest":{"type":"object","properties":{"category":{"type":"string","description":"Optional category name filter when picking a random item.","example":"Beverages"},"outletId":{"type":"string","format":"uuid","description":"Outlet UUID for scoped inventory and product selection.","example":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"}},"required":["outletId"]},"ReorderTabsRequest":{"type":"object","properties":{"OrderedIDs":{"type":"array","items":{"type":"string"},"description":"Ordered list of tab IDs (PascalCase).","example":["tab_01","tab_02"]},"orderedIds":{"type":"array","items":{"type":"string"},"description":"Ordered list of tab IDs (camelCase).","example":["tab_01","tab_02"]}}},"DeleteTabRequest":{"type":"object","properties":{"id":{"type":"string","description":"POS tab ID to soft-archive.","example":"tab_01"}},"required":["id"]},"ProductImportForm":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Excel (.xlsx) file containing required columns: Category, Name, Code, Price (max 5 MB, 5,000 rows)."},"validateOnly":{"type":"string","enum":["true","false"],"description":"When 'true', validates spreadsheet rows without committing database writes.","example":"false"}},"required":["file"]},"OutletImportForm":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Excel (.xlsx) file containing required columns: Code, Name (max 5 MB, 5,000 rows)."}},"required":["file"]},"PromotionDetailRequest":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Target promotion UUID.","example":"p1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"}},"required":["id"]},"RoleDetailRequest":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Target role UUID.","example":"r1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"}},"required":["id"]},"SavePrintTemplateRequest":{"type":"object","properties":{"outletId":{"type":"string","format":"uuid","description":"Outlet UUID whose receipt header/footer template is configured.","example":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"},"header":{"type":"array","items":{"nullable":true},"description":"Ordered list of receipt header blocks/lines.","example":[{"text":"INVOGER STORE","bold":true}]},"footer":{"type":"array","items":{"nullable":true},"description":"Ordered list of receipt footer blocks/lines.","example":[{"text":"Thank you for shopping!"}]}},"required":["outletId","header","footer"]},"DeletePrintTemplatesRequest":{"type":"object","properties":{"outletIds":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100,"description":"Outlet UUIDs whose custom print templates will be reset.","example":["o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"]}},"required":["outletIds"]},"McpJsonRpcRequest":{"type":"object","properties":{"jsonrpc":{"type":"string","enum":["2.0"],"description":"JSON-RPC protocol version.","example":"2.0"},"id":{"anyOf":[{"type":"string"},{"type":"number"}],"description":"Client request identifier.","example":1},"method":{"type":"string","description":"MCP JSON-RPC method (e.g., initialize, tools/list, tools/call).","example":"tools/call"},"params":{"type":"object","additionalProperties":{"nullable":true},"description":"Method-specific parameters.","example":{"name":"get_invoicing_config","arguments":{}}}},"required":["jsonrpc","method"]}},"parameters":{}},"paths":{"/api/auth/login":{"post":{"operationId":"post_auth_login","tags":["Authentication"],"summary":"User Login","description":"Authenticates a user with email or username and password via Supabase Auth without setting auth cookies. Verifies approval status, tenant assignment, and returns a Bearer JWT and refresh token pair (`Cache-Control: no-store`).","security":[],"x-auth":"none","requestBody":{"required":true,"content":{"application/json":{"example":{"email":"owner@company.com","password":"••••••••"},"schema":{"$ref":"#/components/schemas/LoginRequest"}}}},"responses":{"200":{"description":"Login succeeded. Returns access token, refresh token, and synchronized session user.","content":{"application/json":{"example":{"success":true,"data":{"accessToken":"eyJhbGciOiJIUzI1NiIs...","refreshToken":"v1.MRmO7x...","expiresAt":1795664910,"tokenType":"bearer","user":{"id":"e4f8b910-1234-4567-89ab-cdef01234567","email":"owner@company.com","username":"owner","name":"Budi Santoso","role":"System Owner"}}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Missing email/username or password.","content":{"application/json":{"example":{"success":false,"error":"Email/Username and password are required"},"schema":{"$ref":"#/components/schemas/AuthLoginErrorResponse"}}}},"401":{"description":"Unauthorized — Invalid login credentials.","content":{"application/json":{"example":{"success":false,"error":"Invalid login credentials"},"schema":{"$ref":"#/components/schemas/AuthLoginErrorResponse"}}}},"403":{"description":"Forbidden — Account is pending approval, rejected, deactivated, archived, or lacks tenant assignment.","content":{"application/json":{"example":{"success":false,"error":"Your account is pending approval or has been rejected."},"schema":{"$ref":"#/components/schemas/AuthLoginErrorResponse"}}}},"429":{"description":"Too Many Requests — Login rate limit exceeded (returns Retry-After header).","content":{"application/json":{"example":{"success":false,"error":"Too many login attempts. Please try again later."},"schema":{"$ref":"#/components/schemas/AuthLoginErrorResponse"}}}}}}},"/api/auth/refresh-token":{"post":{"operationId":"post_auth_refresh_token","tags":["Authentication"],"summary":"Refresh Bearer Token","description":"Exchanges a valid refresh token for a fresh Supabase Bearer JWT and synchronizes tenant roles, permissions, and outlet scope (`Cache-Control: no-store`).","security":[],"x-auth":"none","requestBody":{"required":true,"content":{"application/json":{"example":{"refreshToken":"v1.MRmO7x..."},"schema":{"$ref":"#/components/schemas/RefreshTokenRequest"}}}},"responses":{"200":{"description":"Token refreshed successfully.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"accessToken":"eyJhbGciOiJIUzI1NiIs...","refreshToken":"v1.NewRefreshToken...","expiresAt":1795668510,"tokenType":"bearer","user":{"email":"owner@company.com","role":"System Owner","permissions":["*"]}}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Missing refresh token or malformed payload.","content":{"application/json":{"example":{"success":false,"message":"Refresh token is required","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Invalid/expired refresh token, inactive account, or missing tenant role.","content":{"application/json":{"example":{"success":false,"message":"Invalid or expired refresh token","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"429":{"description":"Too Many Requests — Refresh endpoint rate limit exceeded.","content":{"application/json":{"example":{"success":false,"message":"Too many refresh requests","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/auth/logout":{"post":{"operationId":"post_auth_logout","tags":["Authentication"],"summary":"User Logout","description":"Revokes the interactive user's refresh session represented by the Bearer JWT via Supabase admin signOut. Not permitted for machine-to-machine integration tokens.","security":[{"bearerAuth":[]}],"x-auth":"bearer","responses":{"200":{"description":"Logged out and session revoked successfully.","content":{"application/json":{"example":{"success":true,"message":"Logged out successfully","data":null},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Integration tokens cannot revoke interactive user sessions.","content":{"application/json":{"example":{"success":false,"message":"Integration tokens cannot revoke interactive user sessions","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/auth/register":{"post":{"operationId":"post_auth_register","tags":["Authentication"],"summary":"Register Tenant Workspace","description":"Provisions a new multi-tenant workspace with a unique store subdomain, default MAIN outlet, and an approved owner user assigned username `admin` and the `System Owner` role (`Cache-Control: no-store`).","security":[],"x-auth":"none","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"Budi Santoso","email":"owner@tokobuah.com","phone":"081234567890","storeName":"Toko Buah Segar","subdomain":"toko-buah-segar","city":"Jakarta Selatan","businessCategory":"retail","plannedOutlets":"1","password":"••••••••","note":"Main store opening setup","verificationMethod":"otp"},"schema":{"$ref":"#/components/schemas/RegisterRequest"}}}},"responses":{"201":{"description":"Workspace tenant, owner user (admin / System Owner), and MAIN outlet created.","content":{"application/json":{"example":{"success":true,"message":"Store workspace registered successfully","data":{"tenant":{"id":"t1a2b3c4-0000-4000-8000-000000000001","name":"Toko Buah Segar","subdomain":"toko-buah-segar","city":"Jakarta Selatan","businessCategory":"retail","plannedOutletCount":"1"},"user":{"id":"e4f8b910-1234-4567-89ab-cdef01234567","email":"owner@tokobuah.com","username":"admin","name":"Budi Santoso","phone":"081234567890","role":"System Owner"},"outlet":{"id":"o1a2b3c4-0000-4000-8000-000000000001","name":"Toko Buah Segar","code":"MAIN"}}},"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true],"description":"Indicates the API operation succeeded.","example":true},"message":{"type":"string","description":"Human-readable response status message.","example":"Store workspace registered successfully"},"data":{"type":"object","properties":{"tenant":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"subdomain":{"type":"string"},"city":{"type":"string","nullable":true},"businessCategory":{"type":"string","nullable":true},"plannedOutletCount":{"type":"string","nullable":true}},"required":["id","name","subdomain","city","businessCategory","plannedOutletCount"]},"user":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"username":{"type":"string"},"name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"role":{"type":"string"}},"required":["id","email","username","name","phone","role"]},"outlet":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"code":{"type":"string"}},"required":["id","name","code"]}},"required":["tenant","user","outlet"]}},"required":["success","message","data"]}}}},"400":{"description":"Bad Request — Invalid registration payload or reserved subdomain.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"409":{"description":"Conflict — Subdomain or owner email address is already registered.","content":{"application/json":{"example":{"success":false,"message":"This store subdomain is already registered. Please choose another URL.","errors":{"code":"SUBDOMAIN_TAKEN"}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"429":{"description":"Too Many Requests — Registration rate limit exceeded (returns Retry-After header).","content":{"application/json":{"example":{"success":false,"message":"Too many registration attempts. Please try again later.","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/auth/get-current-user":{"post":{"operationId":"post_auth_get_current_user","tags":["Authentication"],"summary":"Get Current Actor Profile","description":"Returns the authenticated actor's resolved identity, active tenant ID, role, outlet scope settings, and effective RBAC permissions from PostgreSQL.","security":[{"bearerAuth":[]}],"x-auth":"bearer","responses":{"200":{"description":"Authenticated actor details.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"id":"sb-auth-uuid","databaseId":"e4f8b910-1234-4567-89ab-cdef01234567","email":"owner@company.com","username":"owner","role":"System Owner","tenantId":"t1a2b3c4-0000-4000-8000-000000000001","canViewAll":true,"scopedModules":[],"accessibleOutlets":[],"permissions":["*"]}},"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"message":{"type":"string"},"data":{"type":"object","properties":{"id":{"type":"string"},"databaseId":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"username":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"role":{"type":"string","nullable":true},"tenantId":{"type":"string","format":"uuid"},"canViewAll":{"type":"boolean"},"scopedModules":{"type":"array","items":{"type":"string"}},"accessibleOutlets":{"type":"array","items":{"type":"string"}},"permissions":{"type":"array","items":{"type":"string"}}},"required":["id","email","role"]}},"required":["success","message","data"]}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/auth/update-profile":{"post":{"operationId":"post_auth_update_profile","tags":["Authentication"],"summary":"Update Own Profile","description":"Updates the authenticated user's own name, username, or password. Requires an interactive Bearer JWT; denied for M2M integration tokens.","security":[{"bearerAuth":[]}],"x-auth":"bearer","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"Budi Santoso","username":"budi.santoso"},"schema":{"$ref":"#/components/schemas/ProfileUpdateRequest"}}}},"responses":{"200":{"description":"Profile updated successfully.","content":{"application/json":{"example":{"success":true,"message":"Profile updated successfully","data":{"id":"e4f8b910-1234-4567-89ab-cdef01234567","name":"Budi Santoso","username":"budi.santoso"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Validation error or username already in use.","content":{"application/json":{"example":{"success":false,"message":"Username already in use","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Integration tokens cannot modify user credentials or profile.","content":{"application/json":{"example":{"success":false,"message":"Integration tokens cannot modify user credentials or profile","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/auth/authorize-route":{"post":{"operationId":"post_auth_authorize_route","tags":["Authentication"],"summary":"Authorize Menu Route","description":"Server-side menu authorization helper returning structured 403 details when the caller's role lacks permission for the requested `/menu/*` path.","security":[{"bearerAuth":[]}],"x-auth":"bearer","requestBody":{"required":true,"content":{"application/json":{"example":{"pathname":"/menu/invoices"},"schema":{"$ref":"#/components/schemas/AuthorizeRouteRequest"}}}},"responses":{"200":{"description":"Menu route access is permitted.","content":{"application/json":{"example":{"success":true,"data":{"allowed":true,"requestedPath":"/menu/invoices","route":"/menu/invoices","menu":"Invoices","module":"invoice","role":"Cashier","requiredPermission":"invoice.view"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller's role lacks required permission for this menu route.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"users.view\".","data":{"allowed":false,"requestedPath":"/menu/users","requiredPermission":"users.view"}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/auth/force-sync":{"post":{"operationId":"post_auth_force_sync","tags":["Authentication"],"summary":"Force Sync User Metadata","description":"Re-synchronizes a target tenant user's database role, tenant ID, and permissions to Supabase `app_metadata`. Enforces anti-escalation checks and blocks integration tokens.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"users.update","requestBody":{"required":true,"content":{"application/json":{"example":{"email":"cashier@invoger.com"},"schema":{"$ref":"#/components/schemas/ForceSyncRequest"}}}},"responses":{"200":{"description":"User metadata synchronized successfully.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"message":"Successfully synced metadata for cashier@invoger.com","debug_info":"Please re-login to see changes."}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Missing 'users.update', anti-escalation block, or integration token used.","content":{"application/json":{"example":{"success":false,"message":"Integration tokens cannot trigger auth metadata sync","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"404":{"description":"Not Found — Target user does not exist in the active tenant.","content":{"application/json":{"example":{"success":false,"message":"User not found in the active tenant","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/invoices/submit-invoice":{"post":{"operationId":"post_invoices_submit_invoice","tags":["Invoices"],"summary":"Submit Invoice","description":"Validates and persists one POS invoice atomically with tracked inventory deduction (`INVOICE_SALE`). Recomputes item pricing, promotions, totals, outlet, and actor server-side, and guarantees idempotency via `IdempotencyKey` (`SO-<OUTLET>.<YY>.<MM>.<SEQUENCE>`).","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.create","x-outlet-scoped":"invoice","requestBody":{"required":true,"content":{"application/json":{"example":{"Invoice":{"IdempotencyKey":"a7c28e4b-5f3b-4c2d-9f41-8f8b2d5a0011","InvoiceNumber":"SO-01.26.11.0042","Fulldate":"26/11/2026 14:28:12","Outlet":{"id":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","code":"01","name":"Outlet Senopati"},"Items":[{"productId":"9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d","variantId":"var_1","quantity":2,"unitPrice":25000}],"Payments":[{"method":"CASH","amount":50000}]}},"schema":{"type":"object","properties":{"Invoice":{"type":"object","properties":{"IdempotencyKey":{"type":"string","format":"uuid"},"idempotencyKey":{"type":"string","format":"uuid"},"ID":{"type":"string"},"InvoiceNumber":{"type":"string"},"Rawdate":{"anyOf":[{"type":"string"},{"type":"string","format":"date-time"}]},"Fulldate":{"type":"string"},"Items":{"type":"array","items":{"type":"object","properties":{"ID":{"type":"string"},"productId":{"type":"string","format":"uuid"},"variantId":{"type":"string","format":"uuid"},"variantName":{"type":"string","maxLength":120},"label":{"type":"string"},"quantity":{"type":"number","nullable":true},"unitPrice":{"type":"number","nullable":true},"subtotal":{"type":"number","nullable":true},"discount":{"type":"number","nullable":true},"discountLabel":{"type":"string"},"Description":{"type":"string"},"sku":{"type":"string"},"originalPrice":{"type":"number","nullable":true}},"additionalProperties":{"nullable":true}}},"Outlet":{"nullable":true},"Total":{"type":"number","nullable":true},"Payments":{"type":"array","items":{"nullable":true}},"Totals":{"type":"array","items":{"nullable":true}},"Change":{"type":"number","nullable":true},"Cashier":{"type":"string"},"Note":{"type":"string"},"Member":{"nullable":true},"CreatedByID":{"type":"string"},"CreatedByName":{"type":"string"}},"required":["InvoiceNumber","Items"],"additionalProperties":{"nullable":true}}},"required":["Invoice"]}}}},"responses":{"200":{"description":"OK — Invoice persisted (or idempotent retry matched existing invoice).","content":{"application/json":{"example":{"success":true,"message":"Invoice saved successfully","data":{"ID":"inv_41029412","InvoiceNumber":"SO-01.26.11.0042","Total":50000,"Duplicate":false}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid invoice payload or server business validation error.","content":{"application/json":{"example":{"success":false,"message":"IdempotencyKey is required","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"409":{"description":"Conflict — Insufficient tracked inventory stock; transaction rolled back without saving invoice.","content":{"application/json":{"example":{"success":false,"message":"Insufficient stock for variant 'COF-01'","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/invoices/void-invoice":{"post":{"operationId":"post_invoices_void_invoice","tags":["Invoices"],"summary":"Void Invoice","description":"Voids a previously saved invoice and atomically reverses any deducted tracked inventory movements (`INVOICE_VOID`) inside the same transaction. Enforces outlet scope and writes security audit logs.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.delete","x-outlet-scoped":"invoice","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"inv_41029412","reason":"Customer canceled order before fulfillment"},"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"reason":{"type":"string","minLength":3,"maxLength":250}},"required":["id"]}}}},"responses":{"200":{"description":"OK — Invoice voided and stock restored (idempotent if already voided).","content":{"application/json":{"example":{"success":true,"message":"Invoice voided successfully","data":{"ID":"inv_41029412","InvoiceNumber":"SO-01.26.11.0042","AlreadyVoided":false,"RestoredMovements":1}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Invoice does not exist in active tenant.","content":{"application/json":{"example":{"success":false,"message":"Invoice not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/invoices/get-invoice-list":{"post":{"operationId":"post_invoices_get_invoice_list","tags":["Invoices"],"summary":"Get Invoice List","description":"Retrieves paginated invoices ordered by persistence timestamp (`createdAt`), scoped to the actor's accessible outlets.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.view","x-outlet-scoped":"invoice","requestBody":{"required":true,"content":{"application/json":{"example":{"Outlet":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","Page":1,"Limit":50},"schema":{"type":"object","properties":{"Outlet":{"type":"string"},"Page":{"type":"number","minimum":1,"default":1},"Limit":{"type":"number","minimum":1,"maximum":100,"default":50}}}}}},"responses":{"200":{"description":"OK — Invoice list retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"invoices":[],"total":0,"page":1,"limit":50}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/reprint/get-invoice-detail":{"post":{"operationId":"post_reprint_get_invoice_detail","tags":["Invoices"],"summary":"Get Invoice Detail for Reprint","description":"Retrieves full stored receipt payload for an invoice by ID or full invoice number (`SO-*`) within the active tenant and accessible outlet scope.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.view","x-outlet-scoped":"invoice","requestBody":{"required":true,"content":{"application/json":{"example":{"invoiceNumber":"SO-01.26.11.0042"},"schema":{"$ref":"#/components/schemas/InvoiceDetailRequest"}}}},"responses":{"200":{"description":"OK — Invoice receipt detail retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"id":"inv_41029412","fullInvoiceNumber":"SO-01.26.11.0042","totalAmount":50000}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Missing invoice ID or number.","content":{"application/json":{"example":{"success":false,"message":"Invoice ID or number is required","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Invoice not found or inaccessible.","content":{"application/json":{"example":{"success":false,"message":"Invoice not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/invoices/get-invoicing-config":{"post":{"operationId":"post_invoices_get_invoicing_config","tags":["Invoices"],"summary":"Get Invoicing Configuration & Tabs","description":"Returns active POS quick-select category tabs and pinned products configured for the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.view","responses":{"200":{"description":"OK — POS tab configuration retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"Tabs":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/invoices/get-outlet-list":{"post":{"operationId":"post_invoices_get_outlet_list","tags":["Invoices"],"summary":"Get POS Outlet Selector List","description":"Searches accessible outlets for the active POS invoicing session.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.view","x-outlet-scoped":"invoice","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"","limit":20},"schema":{"$ref":"#/components/schemas/InvoiceOutletQuery"}}}},"responses":{"200":{"description":"OK — Outlet choices retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"outlets":[{"id":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","code":"01","name":"Outlet Senopati"}]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/invoices/get-product-list":{"post":{"operationId":"post_invoices_get_product_list","tags":["Invoices"],"summary":"Search Products for POS Cart","description":"Searches active sellable products and outlet-specific stock quantities for an authorized outlet.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.view","x-outlet-scoped":"invoice","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"Kopi","limit":20,"outletId":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"},"schema":{"$ref":"#/components/schemas/InvoiceProductQuery"}}}},"responses":{"200":{"description":"OK — Matching POS products returned.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"products":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/invoices/get-promotion-list":{"post":{"operationId":"post_invoices_get_promotion_list","tags":["Invoices"],"summary":"Get Applicable Promotions for POS","description":"Lists active promotions optionally filtered by product code for real-time POS cart calculation.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.view","requestBody":{"required":true,"content":{"application/json":{"example":{"productCode":"COF-01","isActive":true,"limit":20},"schema":{"$ref":"#/components/schemas/InvoicePromotionQuery"}}}},"responses":{"200":{"description":"OK — Active promotions returned.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"Promotions":[],"total":0}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/invoices/get-random-product":{"post":{"operationId":"post_invoices_get_random_product","tags":["Invoices"],"summary":"Get Random Product for Quick Entry","description":"Picks one random active product (with valid stock in tracked scenarios) within the authorized outlet for rapid POS invoice entry.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.create","x-outlet-scoped":"invoice","requestBody":{"required":true,"content":{"application/json":{"example":{"outletId":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","category":"Beverages"},"schema":{"$ref":"#/components/schemas/RandomProductRequest"}}}},"responses":{"200":{"description":"OK — Random product returned (or null if none eligible).","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"product":null}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/invoices/get-tab-product-list":{"post":{"operationId":"post_invoices_get_tab_product_list","tags":["Invoices"],"summary":"Get Products for Tab Management","description":"Searches tenant products to assign into custom POS quick-access tabs.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.update","x-outlet-scoped":"product","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"","limit":20,"page":1},"schema":{"type":"object","properties":{"id":{"type":"string"},"query":{"type":"string"},"outlet":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"limit":{"type":"number","minimum":1,"maximum":100,"default":20},"page":{"type":"number","minimum":1,"default":1},"ids":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"OK — Product list for tab editor retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"products":[],"total":0}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/invoices/save-tab":{"post":{"operationId":"post_invoices_save_tab","tags":["Invoices"],"summary":"Create or Update POS Tab","description":"Creates a new POS quick-select tab or updates the name and assigned products of an existing tab.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.update","requestBody":{"required":true,"content":{"application/json":{"example":{"tabName":"Best Sellers","productIds":["9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"]},"schema":{"type":"object","properties":{"id":{"type":"string"},"tabName":{"type":"string","minLength":1},"tabOrder":{"type":"number","nullable":true},"productIds":{"type":"array","items":{"type":"string"}}},"required":["tabName"]}}}},"responses":{"200":{"description":"OK — Tab saved successfully.","content":{"application/json":{"example":{"success":true,"message":"Tab saved successfully","data":{"id":"tab_01","tabName":"Best Sellers"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/invoices/reorder-tabs":{"post":{"operationId":"post_invoices_reorder_tabs","tags":["Invoices"],"summary":"Reorder POS Tabs","description":"Persists the new display order of POS quick-select tabs for the tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.update","requestBody":{"required":true,"content":{"application/json":{"example":{"orderedIds":["tab_01","tab_02"]},"schema":{"$ref":"#/components/schemas/ReorderTabsRequest"}}}},"responses":{"200":{"description":"OK — Tabs reordered successfully.","content":{"application/json":{"example":{"success":true,"message":"Tabs reordered successfully","data":{"Count":2}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Missing OrderedIDs array.","content":{"application/json":{"example":{"success":false,"message":"OrderedIDs array is required","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/invoices/delete-tab":{"post":{"operationId":"post_invoices_delete_tab","tags":["Invoices"],"summary":"Delete POS Tab","description":"Soft-archives a POS quick-select tab by ID.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"invoice.delete","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"tab_01"},"schema":{"$ref":"#/components/schemas/DeleteTabRequest"}}}},"responses":{"200":{"description":"OK — Tab archived successfully.","content":{"application/json":{"example":{"success":true,"message":"Tab archived successfully","data":{"id":"tab_01"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Tab ID is required.","content":{"application/json":{"example":{"success":false,"message":"Tab ID is required","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'invoice.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"invoice.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"invoice.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/products/get-product-list":{"post":{"operationId":"post_products_get_product_list","tags":["Products"],"summary":"Get Product List","description":"Retrieves paginated non-archived catalog products within the active tenant, supporting search, category, and outlet stock filtering.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.view","x-outlet-scoped":"product","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"","limit":20,"page":1},"schema":{"type":"object","properties":{"id":{"type":"string"},"query":{"type":"string"},"outlet":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"limit":{"type":"number","minimum":1,"maximum":100,"default":20},"page":{"type":"number","minimum":1,"default":1},"ids":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"OK — Product list retrieved successfully.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"products":[{"id":"9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d","name":"Palm Sugar Latte","code":"COF-01","price":22000}],"total":1,"page":1,"limit":20}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/products/get-product-info":{"post":{"operationId":"post_products_get_product_info","tags":["Products"],"summary":"Get Product Detail","description":"Fetches full product details, variants, category, brand, supplier, tags, and scoped outlet inventory levels by product UUID.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.view","x-outlet-scoped":"product","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"},"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]}}}},"responses":{"200":{"description":"OK — Product details retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"id":"9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d","name":"Palm Sugar Latte","code":"COF-01"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Product does not exist in active tenant.","content":{"application/json":{"example":{"success":false,"message":"Product not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/products/get-variant-list":{"post":{"operationId":"post_products_get_variant_list","tags":["Products"],"summary":"Get Variant List","description":"Retrieves sellable product variants scoped to the tenant and outlet access with status, inventory tracking, brand, category, and supplier filters.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.view","x-outlet-scoped":"product","requestBody":{"required":true,"content":{"application/json":{"example":{"status":"ACTIVE","inventory":"ALL","orderBy":"NAME","orderDirection":"ASC","limit":20,"page":1},"schema":{"type":"object","properties":{"query":{"type":"string","maxLength":100},"status":{"type":"string","enum":["ALL","ACTIVE","INACTIVE"],"default":"ALL"},"inventory":{"type":"string","enum":["ALL","TRACKED","UNTRACKED"],"default":"ALL"},"category":{"type":"string","minLength":1,"maxLength":200},"brand":{"type":"string","minLength":1,"maxLength":100},"supplier":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","minLength":1,"maxLength":50},"outletId":{"type":"string","format":"uuid"},"orderBy":{"type":"string","enum":["NAME","CREATED"],"default":"NAME"},"orderDirection":{"type":"string","enum":["ASC","DESC"],"default":"ASC"},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20},"page":{"type":"integer","minimum":1,"default":1}}}}}},"responses":{"200":{"description":"OK — Variant list retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"variants":[],"total":0,"page":1,"limit":20}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/products/get-variant-filter-options":{"post":{"operationId":"post_products_get_variant_filter_options","tags":["Products"],"summary":"Get Variant Filter Options","description":"Returns compact tenant-scoped option sets (categories, brands, suppliers, product types) for the product variant filter dialog.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.view","responses":{"200":{"description":"OK — Variant filter options retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"options":{"categories":[],"brands":[],"suppliers":[]}}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/products/create-product":{"post":{"operationId":"post_products_create_product","tags":["Products"],"summary":"Create Product","description":"Creates a new single-variant or multi-variant product in the active tenant and dispatches `product.created` webhook events if configured.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.create","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"Palm Sugar Latte","code":"COF-01","category":"Beverages","cost":9000,"price":22000,"uom":"Cup","pricingType":"Single","type":"Standard","trackInventory":true},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"code":{"type":"string","minLength":1,"maxLength":100},"category":{"type":"string","nullable":true,"maxLength":200},"cost":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0},"price":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0},"weight":{"type":"number","nullable":true,"minimum":0,"maximum":999999999,"default":0},"uom":{"type":"string","minLength":1,"maxLength":50,"default":"Pcs"},"pricingType":{"type":"string","enum":["Single","Multiple"],"default":"Single"},"type":{"type":"string","enum":["Standard","Non-Inventory","Composite","Batch Number","Manufactured","Serialized"],"default":"Standard"},"brand":{"type":"string","nullable":true,"maxLength":100},"supplier":{"type":"string","nullable":true,"maxLength":200},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"maxItems":20,"default":[]},"imageUrl":{"anyOf":[{"type":"string","maxLength":2796331},{"type":"string","enum":[""]},{"nullable":true}]},"images":{"type":"array","items":{"type":"string","maxLength":2796331},"maxItems":5,"default":[]},"isActive":{"type":"boolean","default":true},"description":{"type":"string","nullable":true,"maxLength":3000},"storage":{"type":"string","nullable":true,"maxLength":200},"barcode":{"type":"string","nullable":true,"maxLength":100},"trackInventory":{"type":"boolean","default":false},"outlet":{"type":"string","nullable":true,"maxLength":100},"variantMode":{"type":"string","enum":["SINGLE","MULTIPLE"]},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true,"format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":100},"code":{"type":"string","minLength":1,"maxLength":100},"barcode":{"type":"string","nullable":true,"maxLength":100},"cost":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0},"price":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0},"weight":{"type":"number","nullable":true,"minimum":0,"maximum":999999999,"default":0},"uom":{"type":"string","minLength":1,"maxLength":50,"default":"Pcs"},"isDefault":{"type":"boolean","default":false},"isActive":{"type":"boolean","default":true},"sortOrder":{"type":"integer","nullable":true,"minimum":0,"maximum":99}},"required":["name","code"]},"minItems":1,"maxItems":100}},"required":["name","code"]}}}},"responses":{"201":{"description":"Created — Product created successfully.","content":{"application/json":{"example":{"success":true,"message":"Product created successfully","data":{"id":"9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d","code":"COF-01"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"409":{"description":"Conflict — Product or variant identity (SKU/barcode) already exists.","content":{"application/json":{"example":{"success":false,"message":"Product or variant identity already exists","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/products/update-product":{"post":{"operationId":"post_products_update_product","tags":["Products"],"summary":"Update Product","description":"Updates product attributes and variant definitions within the active tenant and dispatches `product.updated` webhook events.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.update","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d","name":"Palm Sugar Iced Latte","code":"COF-01","price":24000},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"code":{"type":"string","minLength":1,"maxLength":100},"category":{"type":"string","nullable":true,"maxLength":200},"cost":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0},"price":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0},"weight":{"type":"number","nullable":true,"minimum":0,"maximum":999999999,"default":0},"uom":{"type":"string","minLength":1,"maxLength":50,"default":"Pcs"},"pricingType":{"type":"string","enum":["Single","Multiple"],"default":"Single"},"type":{"type":"string","enum":["Standard","Non-Inventory","Composite","Batch Number","Manufactured","Serialized"],"default":"Standard"},"brand":{"type":"string","nullable":true,"maxLength":100},"supplier":{"type":"string","nullable":true,"maxLength":200},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"maxItems":20,"default":[]},"imageUrl":{"anyOf":[{"type":"string","maxLength":2796331},{"type":"string","enum":[""]},{"nullable":true}]},"images":{"type":"array","items":{"type":"string","maxLength":2796331},"maxItems":5,"default":[]},"isActive":{"type":"boolean","default":true},"description":{"type":"string","nullable":true,"maxLength":3000},"storage":{"type":"string","nullable":true,"maxLength":200},"barcode":{"type":"string","nullable":true,"maxLength":100},"trackInventory":{"type":"boolean","default":false},"outlet":{"type":"string","nullable":true,"maxLength":100},"variantMode":{"type":"string","enum":["SINGLE","MULTIPLE"]},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true,"format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":100},"code":{"type":"string","minLength":1,"maxLength":100},"barcode":{"type":"string","nullable":true,"maxLength":100},"cost":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0},"price":{"type":"number","nullable":true,"minimum":0,"maximum":999999999999,"default":0},"weight":{"type":"number","nullable":true,"minimum":0,"maximum":999999999,"default":0},"uom":{"type":"string","minLength":1,"maxLength":50,"default":"Pcs"},"isDefault":{"type":"boolean","default":false},"isActive":{"type":"boolean","default":true},"sortOrder":{"type":"integer","nullable":true,"minimum":0,"maximum":99}},"required":["name","code"]},"minItems":1,"maxItems":100},"id":{"type":"string","format":"uuid"}},"required":["name","code","id"]}}}},"responses":{"200":{"description":"OK — Product updated successfully.","content":{"application/json":{"example":{"success":true,"message":"Product updated successfully","data":{"id":"9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d","name":"Palm Sugar Iced Latte"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Product does not exist.","content":{"application/json":{"example":{"success":false,"message":"Product not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"409":{"description":"Conflict — Product or variant code/barcode collision.","content":{"application/json":{"example":{"success":false,"message":"Product or variant identity already exists","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/products/form-product":{"post":{"operationId":"post_products_form_product","tags":["Products"],"summary":"Load Product Form Options","description":"Loads tenant-scoped options (categories, brands, suppliers, storages, existing product when `id` is supplied). Dynamically enforces `product.update` when `id` is provided or `product.create` otherwise.","security":[{"bearerAuth":[]}],"x-auth":"bearer","requestBody":{"required":true,"content":{"application/json":{"example":{"id":null,"option":"category"},"schema":{"type":"object","properties":{"id":{"type":"string","nullable":true,"format":"uuid"},"option":{"type":"string","enum":["category","brand","supplier","storage"]}}}}}},"responses":{"200":{"description":"OK — Product form metadata loaded.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"product":null,"options":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Missing 'product.create' or 'product.update' permission.","content":{"application/json":{"example":{"success":false,"message":"Role \"Cashier\" does not have permission \"product.create\".","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"404":{"description":"Not Found — Requested product `id` does not exist.","content":{"application/json":{"example":{"success":false,"message":"Product not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/products/check-variant-uniqueness":{"post":{"operationId":"post_products_check_variant_uniqueness","tags":["Products"],"summary":"Check Variant Uniqueness","description":"Pre-validates variant names, SKU codes, and barcodes against existing tenant records before saving. Checks `product.update` if `productId` is provided or `product.create` otherwise.","security":[{"bearerAuth":[]}],"x-auth":"bearer","requestBody":{"required":true,"content":{"application/json":{"example":{"variants":[{"name":"Large","code":"COF-01-L","barcode":"8991234567890"}]},"schema":{"type":"object","properties":{"productId":{"type":"string","nullable":true,"format":"uuid"},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true,"format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":100},"code":{"type":"string","minLength":1,"maxLength":100},"barcode":{"type":"string","nullable":true,"maxLength":100}},"required":["name","code"]},"minItems":1,"maxItems":100}},"required":["variants"]}}}},"responses":{"200":{"description":"OK — Uniqueness check completed.","content":{"application/json":{"example":{"success":true,"message":"Variant uniqueness checked","data":{"valid":true,"conflicts":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Missing 'product.create' or 'product.update'.","content":{"application/json":{"example":{"success":false,"message":"Role \"Cashier\" does not have permission \"product.create\".","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/products/archive-product":{"post":{"operationId":"post_products_archive_product","tags":["Products"],"summary":"Archive Product","description":"Soft-archives a single product and deactivates its variants within the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.archive","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"},"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]}}}},"responses":{"200":{"description":"OK — Product archived successfully.","content":{"application/json":{"example":{"success":true,"message":"Product archived successfully","data":{"id":"9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d","isArchived":true}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.archive' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.archive\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.archive"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Product not found.","content":{"application/json":{"example":{"success":false,"message":"Product not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/products/delete-products":{"post":{"operationId":"post_products_delete_products","tags":["Products"],"summary":"Delete Products","description":"Soft-deletes (archives) one or multiple products (up to 100 UUIDs per request) within the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.delete","requestBody":{"required":true,"content":{"application/json":{"example":{"ids":["9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"]},"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100}},"required":["ids"]}}}},"responses":{"200":{"description":"OK — Products deleted successfully.","content":{"application/json":{"example":{"success":true,"message":"Products deleted successfully","data":null},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/products/delete-product-permanently":{"post":{"operationId":"post_products_delete_product_permanently","tags":["Products"],"summary":"Delete Product Permanently","description":"Permanently destroys an already archived or unlinked product record. Requires explicit `confirmation: \"DELETE\"` literal.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.delete","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d","confirmation":"DELETE"},"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"confirmation":{"type":"string","enum":["DELETE"]}},"required":["id","confirmation"]}}}},"responses":{"200":{"description":"OK — Product permanently deleted.","content":{"application/json":{"example":{"success":true,"message":"Product deleted permanently","data":null},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Product not found.","content":{"application/json":{"example":{"success":false,"message":"Product not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"409":{"description":"Conflict — Product still referenced by historical invoices or movements.","content":{"application/json":{"example":{"success":false,"message":"Cannot permanently delete product referenced by transactions","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/products/cleanup":{"post":{"operationId":"post_products_cleanup","tags":["Products"],"summary":"Cleanup Duplicate Products","description":"Detects duplicate active products sharing the same product code in the active tenant and soft-archives older duplicates.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.delete","x-outlet-scoped":"product","responses":{"200":{"description":"OK — Duplicate cleanup finished.","content":{"application/json":{"example":{"success":true,"message":"Cleanup complete. Archived 0 duplicate products.","data":{"deletedCount":0,"archivedCount":0,"details":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/products/get-category-list":{"post":{"operationId":"post_products_get_category_list","tags":["Products"],"summary":"Get Product Categories","description":"Returns hierarchical product categories defined in the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.view","responses":{"200":{"description":"OK — Category list retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"categories":["Beverages","Food"]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/products/update-category":{"post":{"operationId":"post_products_update_category","tags":["Products"],"summary":"Update Category Hierarchy","description":"Renames or re-parents products from `sourceKey` category path to `targetKey` across the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.update","requestBody":{"required":true,"content":{"application/json":{"example":{"sourceKey":"Drinks","targetKey":"Beverages"},"schema":{"type":"object","properties":{"sourceKey":{"type":"string","minLength":1,"maxLength":200},"targetKey":{"type":"string","nullable":true,"maxLength":200}},"required":["sourceKey"]}}}},"responses":{"200":{"description":"OK — Category updated across matching products.","content":{"application/json":{"example":{"success":true,"message":"Category updated successfully","data":{"updatedCount":12}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/products/get-products-count":{"post":{"operationId":"post_products_get_products_count","tags":["Products"],"summary":"Get Product Counts by Category","description":"Returns active product totals grouped by category for navigation badges and catalog summaries.","security":[{"bearerAuth":[]}],"x-auth":"bearer","responses":{"200":{"description":"OK — Counts retrieved.","content":{"application/json":{"example":{"success":true,"message":"Products count retrieved successfully","data":{"counts":{"Beverages":14}}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/products/get-tag-options":{"post":{"operationId":"post_products_get_tag_options","tags":["Products"],"summary":"Get Tag Options","description":"Searches tenant-scoped product tags for form selectors and filters.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.view","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"signature","limit":50},"schema":{"type":"object","properties":{"query":{"type":"string","maxLength":100},"limit":{"type":"integer","minimum":1,"maximum":100,"default":50}}}}}},"responses":{"200":{"description":"OK — Tag options retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"options":["signature"]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/products/create-brand":{"post":{"operationId":"post_products_create_brand","tags":["Products"],"summary":"Create Brand","description":"Creates a new product brand in the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.create","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"Invoger Roastery","description":"House coffee blend"},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","nullable":true,"maxLength":500}},"required":["name"]}}}},"responses":{"201":{"description":"Created — Brand created.","content":{"application/json":{"example":{"success":true,"message":"Brand created successfully","data":{"id":"brd_1","name":"Invoger Roastery"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"409":{"description":"Conflict — Brand already exists.","content":{"application/json":{"example":{"success":false,"message":"Brand already exists","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/products/create-supplier":{"post":{"operationId":"post_products_create_supplier","tags":["Products"],"summary":"Create Supplier","description":"Creates a new product supplier record in the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.create","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"PT Kopi Nusantara","code":"SUP-01","email":"sales@kopinusantara.co.id","status":"Active"},"schema":{"type":"object","properties":{"code":{"type":"string","nullable":true,"maxLength":50},"name":{"type":"string","minLength":1,"maxLength":200},"firstName":{"type":"string","nullable":true,"maxLength":100},"lastName":{"type":"string","nullable":true,"maxLength":100},"email":{"anyOf":[{"type":"string","maxLength":254,"format":"email"},{"type":"string","enum":[""]},{"nullable":true}]},"phone":{"type":"string","nullable":true,"maxLength":50},"mobile":{"type":"string","nullable":true,"maxLength":50},"address":{"type":"string","nullable":true,"maxLength":500},"city":{"type":"string","nullable":true,"maxLength":100},"state":{"type":"string","nullable":true,"maxLength":100},"zipCode":{"type":"string","nullable":true,"maxLength":20},"country":{"type":"string","nullable":true,"maxLength":100},"gender":{"type":"string","nullable":true,"maxLength":30},"group":{"type":"string","nullable":true,"maxLength":100},"imageUrl":{"anyOf":[{"type":"string","maxLength":2048,"format":"uri"},{"type":"string","enum":[""]},{"nullable":true}]},"notes":{"type":"string","nullable":true,"maxLength":2000},"status":{"type":"string","enum":["Active","Inactive","Suspended"],"default":"Active"}},"required":["name"]}}}},"responses":{"201":{"description":"Created — Supplier created.","content":{"application/json":{"example":{"success":true,"message":"Supplier created successfully","data":{"id":"sup_1","name":"PT Kopi Nusantara","code":"SUP-01"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"409":{"description":"Conflict — Supplier code already exists.","content":{"application/json":{"example":{"success":false,"message":"Supplier code already exists","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/products/create-tag":{"post":{"operationId":"post_products_create_tag","tags":["Products"],"summary":"Create Tag","description":"Creates a new product tag in the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.create","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"best-seller"},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50}},"required":["name"]}}}},"responses":{"201":{"description":"Created — Tag created.","content":{"application/json":{"example":{"success":true,"message":"Tag created successfully","data":{"id":"tag_1","name":"best-seller"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"409":{"description":"Conflict — Tag already exists.","content":{"application/json":{"example":{"success":false,"message":"Tag already exists","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/products/import":{"post":{"operationId":"post_products_import","tags":["Products"],"summary":"Import Products (XLSX)","description":"Batch imports or validates products from an Excel (.xlsx) spreadsheet (`multipart/form-data`, max 5 MB, max 5,000 rows). Requires `Category`, `Name`, `Code`, and `Price` headers.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"product.create","requestBody":{"required":true,"content":{"multipart/form-data":{"example":{"file":"<binary .xlsx file>","validateOnly":"false"},"schema":{"$ref":"#/components/schemas/ProductImportForm"}}}},"responses":{"200":{"description":"OK — Spreadsheet validated or imported successfully.","content":{"application/json":{"example":{"success":true,"message":"Products imported successfully","data":{"createdCount":15,"updatedCount":4}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid file, missing headers, or row validation failure.","content":{"application/json":{"example":{"success":false,"message":"Invalid file structure! Missing: Category, Name, Code, Price","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'product.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"product.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"product.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/outlets/get-outlet-list":{"post":{"operationId":"post_outlets_get_outlet_list","tags":["Outlets"],"summary":"Get Outlet List","description":"Retrieves paginated physical store outlets within the active tenant, automatically filtered to the actor's accessible outlets when outlet restriction applies.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"outlet.view","x-outlet-scoped":"outlet","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"","limit":20,"page":1},"schema":{"type":"object","properties":{"id":{"type":"string"},"query":{"type":"string"},"limit":{"type":"number","minimum":1,"maximum":1000,"default":20},"page":{"type":"number","minimum":1,"default":1}}}}}},"responses":{"200":{"description":"OK — Outlets retrieved successfully.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"outlets":[{"id":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","code":"01","name":"Outlet Senopati","address":"Jl. Senopati No. 10"}],"total":1,"page":1,"limit":20}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'outlet.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"outlet.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"outlet.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/outlets/create-outlet":{"post":{"operationId":"post_outlets_create_outlet","tags":["Outlets"],"summary":"Create Outlet","description":"Creates a new store outlet with a tenant-unique code and triggers `outlet.created` webhook events if subscribed.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"outlet.create","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"Outlet Kemang","code":"02","title":"INVOGER KEMANG","cashier":"Default Cashier","address":"Jl. Kemang Raya No. 8"},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"code":{"type":"string","minLength":1},"title":{"type":"string","nullable":true},"cashier":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"whatsapp":{"type":"string","nullable":true}},"required":["name","code"]}}}},"responses":{"201":{"description":"Created — Outlet created successfully.","content":{"application/json":{"example":{"success":true,"message":"Outlet created successfully","data":{"id":"o2b3c4d5-e6f7-8a9b-0c1d-2e3f4a5b6c7d","code":"02","name":"Outlet Kemang"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'outlet.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"outlet.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"outlet.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"409":{"description":"Conflict — Outlet code already exists in this tenant.","content":{"application/json":{"example":{"success":false,"message":"Outlet code already exists","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/outlets/update-outlet":{"post":{"operationId":"post_outlets_update_outlet","tags":["Outlets"],"summary":"Update Outlet","description":"Updates an existing outlet's details. Enforces outlet scope restriction and unique outlet code constraints.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"outlet.update","x-outlet-scoped":"outlet","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Outlet Senopati Flagship","code":"01"},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"code":{"type":"string","minLength":1},"title":{"type":"string","nullable":true},"cashier":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"whatsapp":{"type":"string","nullable":true},"id":{"type":"string","format":"uuid"}},"required":["name","code","id"]}}}},"responses":{"200":{"description":"OK — Outlet updated successfully.","content":{"application/json":{"example":{"success":true,"message":"Outlet updated successfully","data":{"id":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Outlet Senopati Flagship","code":"01"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'outlet.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"outlet.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"outlet.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Outlet not found.","content":{"application/json":{"example":{"success":false,"message":"Outlet not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"409":{"description":"Conflict — Outlet code already exists.","content":{"application/json":{"example":{"success":false,"message":"Outlet code already exists","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/outlets/delete-outlets":{"post":{"operationId":"post_outlets_delete_outlets","tags":["Outlets"],"summary":"Delete Outlets","description":"Soft-archives one or more outlets within the active tenant. Enforces accessible outlet scope for restricted actors.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"outlet.delete","x-outlet-scoped":"outlet","requestBody":{"required":true,"content":{"application/json":{"example":{"ids":["o2b3c4d5-e6f7-8a9b-0c1d-2e3f4a5b6c7d"]},"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100}},"required":["ids"]}}}},"responses":{"200":{"description":"OK — Outlets deleted successfully.","content":{"application/json":{"example":{"success":true,"message":"Outlets deleted successfully","data":null},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'outlet.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"outlet.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"outlet.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Target outlet not found.","content":{"application/json":{"example":{"success":false,"message":"Outlet not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/outlets/import":{"post":{"operationId":"post_outlets_import","tags":["Outlets"],"summary":"Import Outlets (XLSX)","description":"Batch imports or updates outlets from an Excel (.xlsx) spreadsheet (`multipart/form-data`, max 5 MB, max 5,000 rows). Requires `Code` and `Name` columns.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"outlet.create","requestBody":{"required":true,"content":{"multipart/form-data":{"example":{"file":"<binary .xlsx file>"},"schema":{"$ref":"#/components/schemas/OutletImportForm"}}}},"responses":{"200":{"description":"OK — Import completed.","content":{"application/json":{"example":{"success":true,"message":"Outlets imported successfully","data":{"createdCount":3,"updatedCount":1}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Missing file, size > 5 MB, row count > 5,000, or missing required columns.","content":{"application/json":{"example":{"success":false,"message":"Missing columns: Code, Name","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'outlet.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"outlet.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"outlet.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/inventory/get-inventory-list":{"post":{"operationId":"post_inventory_get_inventory_list","tags":["Inventory"],"summary":"Get Inventory List","description":"Retrieves tracked stock levels isolated per `(tenantId, outletId, productId)`. Filters results to outlets accessible by the actor when outlet scoping is enabled.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"inventory.view","x-outlet-scoped":"inventory","requestBody":{"required":true,"content":{"application/json":{"example":{"outletId":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","query":"Coffee","page":1,"limit":20},"schema":{"type":"object","properties":{"outletId":{"type":"string","format":"uuid"},"category":{"type":"string"},"query":{"type":"string","maxLength":100},"page":{"type":"integer","minimum":1,"default":1},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20}}}}}},"responses":{"200":{"description":"OK — Inventory items retrieved successfully.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"items":[{"outletId":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","productId":"prd_1","variantId":"var_1","quantity":45,"minimumStock":5}],"total":1,"page":1,"limit":20}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'inventory.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"inventory.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"inventory.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/inventory/get-inventory-history":{"post":{"operationId":"post_inventory_get_inventory_history","tags":["Inventory"],"summary":"Get Inventory Movement History","description":"Lists immutable inventory movement audit entries (`SET`, `ADJUSTMENT_IN`, `ADJUSTMENT_OUT`, `INVOICE_SALE`, `INVOICE_VOID`) scoped to tenant and accessible outlets.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"inventory.view","x-outlet-scoped":"inventory","requestBody":{"required":true,"content":{"application/json":{"example":{"outletId":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","type":"INVOICE_SALE","page":1,"limit":20},"schema":{"type":"object","properties":{"outletId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["SET","ADJUSTMENT_IN","ADJUSTMENT_OUT","INVOICE_SALE","INVOICE_VOID"]},"query":{"type":"string","maxLength":100},"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"page":{"type":"integer","minimum":1,"default":1},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20}}}}}},"responses":{"200":{"description":"OK — Inventory movements retrieved successfully.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"movements":[{"id":"mov_1","type":"INVOICE_SALE","delta":-2,"quantityBefore":47,"quantityAfter":45,"referenceId":"inv_123","createdAt":"2026-11-26T10:15:00.000Z"}],"total":1}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'inventory.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"inventory.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"inventory.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/inventory/update-inventory":{"post":{"operationId":"post_inventory_update_inventory","tags":["Inventory"],"summary":"Update Inventory Level","description":"Performs an idempotent stock adjustment (`SET`, `IN`, or `OUT`) inside a database transaction using `idempotencyKey`. Rejects negative stock outcomes with `409 Conflict`.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"inventory.update","x-outlet-scoped":"inventory","requestBody":{"required":true,"content":{"application/json":{"example":{"outletId":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","productId":"9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d","operation":"IN","quantity":25,"reason":"Restock shipment #PO-104","idempotencyKey":"11111111-2222-4333-8444-555555555555"},"schema":{"type":"object","properties":{"outletId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"variantId":{"type":"string","format":"uuid"},"operation":{"type":"string","enum":["SET","IN","OUT"]},"quantity":{"type":"integer","nullable":true,"minimum":0,"maximum":1000000},"minimumStock":{"type":"integer","nullable":true,"minimum":0,"maximum":1000000},"reason":{"type":"string","minLength":3,"maxLength":250},"idempotencyKey":{"type":"string","format":"uuid"}},"required":["outletId","productId","operation","quantity","reason","idempotencyKey"]}}}},"responses":{"200":{"description":"OK — Inventory adjusted (or existing idempotent result returned).","content":{"application/json":{"example":{"success":true,"message":"Inventory updated successfully","data":{"quantityAfter":70,"Duplicate":false}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'inventory.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"inventory.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"inventory.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"409":{"description":"Conflict — Resulting stock quantity would become negative.","content":{"application/json":{"example":{"success":false,"message":"Insufficient stock for adjustment","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/inventory/get-outlet-options":{"post":{"operationId":"post_inventory_get_outlet_options","tags":["Inventory"],"summary":"Get Accessible Outlet Options for Inventory","description":"Menu-owned compact endpoint returning outlet options accessible to the caller for Inventory filters.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"inventory.view","x-outlet-scoped":"inventory","requestBody":{"required":true,"content":{"application/json":{"example":{"query":""},"schema":{"type":"object","properties":{"query":{"type":"string","maxLength":100}}}}}},"responses":{"200":{"description":"OK — Accessible outlet options retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"options":[{"id":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Outlet Senopati"}],"canFilter":false}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'inventory.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"inventory.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"inventory.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/inventory/get-category-options":{"post":{"operationId":"post_inventory_get_category_options","tags":["Inventory"],"summary":"Get Category Options for Inventory","description":"Menu-owned compact endpoint returning tenant product category options for Inventory filter dropdowns.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"inventory.view","responses":{"200":{"description":"OK — Category options retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"options":[{"label":"Beverages","value":"beverages"}]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'inventory.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"inventory.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"inventory.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/promotions/get-promotion-list":{"post":{"operationId":"post_promotions_get_promotion_list","tags":["Promotions"],"summary":"Get Promotion List","description":"Retrieves paginated discount and tiered pricing promotions within the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"promotion.view","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"","isActive":true,"limit":20,"page":1},"schema":{"type":"object","properties":{"id":{"type":"string"},"query":{"type":"string"},"productIds":{"type":"string"},"productCode":{"type":"string"},"category":{"type":"string"},"isActive":{"type":"boolean","nullable":true},"limit":{"type":"number","minimum":1,"maximum":100,"default":20},"page":{"type":"number","minimum":1,"default":1}}}}}},"responses":{"200":{"description":"OK — Promotion list retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"Promotions":[],"Total":0}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'promotion.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"promotion.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"promotion.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/promotions/get-promotion-detail":{"post":{"operationId":"post_promotions_get_promotion_detail","tags":["Promotions"],"summary":"Get Promotion Detail","description":"Retrieves full configuration, eligible products/categories, and pricing tiers for one promotion UUID.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"promotion.view","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"p1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"},"schema":{"$ref":"#/components/schemas/PromotionDetailRequest"}}}},"responses":{"200":{"description":"OK — Promotion detail retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"id":"p1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Happy Hour 10%","type":"PERCENTAGE","value":10}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'promotion.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"promotion.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"promotion.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Promotion not found.","content":{"application/json":{"example":{"success":false,"message":"Promotion not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/promotions/create-promotion":{"post":{"operationId":"post_promotions_create_promotion","tags":["Promotions"],"summary":"Create Promotion","description":"Creates a new percentage, nominal, or tiered-quantity promotion in the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"promotion.create","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"Afternoon Coffee 15%","type":"PERCENTAGE","value":15,"categories":["Beverages"],"isActive":true},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"type":{"type":"string","minLength":1},"value":{"type":"number","nullable":true},"description":{"type":"string","nullable":true},"displayStyle":{"type":"string","nullable":true},"productIds":{"type":"array","nullable":true,"items":{"type":"string","format":"uuid"},"maxItems":1000},"categories":{"type":"array","nullable":true,"items":{"type":"string"}},"isActive":{"type":"boolean","default":true},"minQuantity":{"type":"integer","nullable":true,"minimum":1},"tiers":{"nullable":true}},"required":["name","type","value"]}}}},"responses":{"201":{"description":"Created — Promotion created successfully.","content":{"application/json":{"example":{"success":true,"message":"Promotion created successfully","data":{"id":"p1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Afternoon Coffee 15%"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'promotion.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"promotion.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"promotion.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/promotions/update-promotion":{"post":{"operationId":"post_promotions_update_promotion","tags":["Promotions"],"summary":"Update Promotion","description":"Updates an existing promotion's rules, value, or active status.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"promotion.update","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"p1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","isActive":false},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"type":{"type":"string","minLength":1},"value":{"type":"number","nullable":true},"description":{"type":"string","nullable":true},"displayStyle":{"type":"string","nullable":true},"productIds":{"type":"array","nullable":true,"items":{"type":"string","format":"uuid"},"maxItems":1000},"categories":{"type":"array","nullable":true,"items":{"type":"string"}},"isActive":{"type":"boolean","default":true},"minQuantity":{"type":"integer","nullable":true,"minimum":1},"tiers":{"nullable":true},"id":{"type":"string","format":"uuid"}},"required":["id"]}}}},"responses":{"200":{"description":"OK — Promotion updated successfully.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"id":"p1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","isActive":false}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'promotion.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"promotion.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"promotion.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/promotions/delete-promotions":{"post":{"operationId":"post_promotions_delete_promotions","tags":["Promotions"],"summary":"Delete Promotions","description":"Deletes or archives up to 100 promotions within the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"promotion.delete","requestBody":{"required":true,"content":{"application/json":{"example":{"ids":["p1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"]},"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100}},"required":["ids"]}}}},"responses":{"200":{"description":"OK — Promotions deleted successfully.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"count":1}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'promotion.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"promotion.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"promotion.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/promotions/get-product-list":{"post":{"operationId":"post_promotions_get_product_list","tags":["Promotions"],"summary":"Get Product Options for Promotions","description":"Menu-owned endpoint listing tenant products (outlet-scoped when restricted) for promotion targeting.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"promotion.view","x-outlet-scoped":"product","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"","limit":20,"page":1},"schema":{"type":"object","properties":{"id":{"type":"string"},"query":{"type":"string"},"outlet":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"limit":{"type":"number","minimum":1,"maximum":100,"default":20},"page":{"type":"number","minimum":1,"default":1},"ids":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"OK — Product options retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"products":[],"total":0}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'promotion.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"promotion.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"promotion.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/promotions/get-category-list":{"post":{"operationId":"post_promotions_get_category_list","tags":["Promotions"],"summary":"Get Category Options for Promotions","description":"Menu-owned endpoint listing tenant product categories for promotion targeting.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"promotion.view","responses":{"200":{"description":"OK — Category options retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"categories":["Beverages"]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'promotion.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"promotion.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"promotion.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/contacts/get-contact-list":{"post":{"operationId":"post_contacts_get_contact_list","tags":["Contacts"],"summary":"Get Contact List","description":"Retrieves paginated customers and contacts within the active tenant, supporting search query, status, and customer group filters.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"contact.view","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"Andi","status":"Active","page":1,"limit":20},"schema":{"type":"object","properties":{"query":{"type":"string"},"status":{"type":"string"},"group":{"type":"string"},"page":{"type":"number","minimum":1,"default":1},"limit":{"type":"number","minimum":1,"maximum":100,"default":20}}}}}},"responses":{"200":{"description":"OK — Contact list retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"contacts":[{"id":"cnt_1","name":"Andi Wijaya","code":"CUST-001","email":"andi@example.com","phone":"08123456789","status":"Active"}],"total":1,"page":1,"limit":20}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'contact.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"contact.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"contact.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/contacts/get-contact-info":{"post":{"operationId":"post_contacts_get_contact_info","tags":["Contacts"],"summary":"Get Contact Info","description":"Retrieves detailed contact information by contact ID within the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"contact.view","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"cnt_1"},"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1}},"required":["id"]}}}},"responses":{"200":{"description":"OK — Contact detail retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"id":"cnt_1","name":"Andi Wijaya","code":"CUST-001","email":"andi@example.com","status":"Active"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'contact.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"contact.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"contact.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Contact does not exist in active tenant.","content":{"application/json":{"example":{"success":false,"message":"Contact not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/contacts/create-contact":{"post":{"operationId":"post_contacts_create_contact","tags":["Contacts"],"summary":"Create Contact","description":"Creates a new customer/contact record with a tenant-unique contact code.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"contact.create","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"Andi Wijaya","code":"CUST-001","email":"andi@example.com","phone":"+628123456789","status":"Active"},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"code":{"type":"string","minLength":1,"maxLength":100},"firstName":{"type":"string","nullable":true,"maxLength":100},"lastName":{"type":"string","nullable":true,"maxLength":100},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"string","enum":[""]},{"nullable":true}]},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"string","enum":[""]},{"nullable":true}]},"mobile":{"anyOf":[{"type":"string","maxLength":50},{"type":"string","enum":[""]},{"nullable":true}]},"address":{"anyOf":[{"type":"string","maxLength":500},{"type":"string","enum":[""]},{"nullable":true}]},"city":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}]},"state":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}]},"zipCode":{"anyOf":[{"type":"string","maxLength":20},{"type":"string","enum":[""]},{"nullable":true}]},"country":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}]},"gender":{"anyOf":[{"type":"string","maxLength":20},{"type":"string","enum":[""]},{"nullable":true}]},"group":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}]},"notes":{"anyOf":[{"type":"string","maxLength":1000},{"type":"string","enum":[""]},{"nullable":true}]},"status":{"type":"string","enum":["Active","Inactive"],"default":"Active"}},"required":["name","code"]}}}},"responses":{"201":{"description":"Created — Contact created successfully.","content":{"application/json":{"example":{"success":true,"message":"Contact created successfully","data":{"id":"cnt_1","name":"Andi Wijaya","code":"CUST-001","status":"Active"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'contact.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"contact.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"contact.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"409":{"description":"Conflict — Contact code already exists in active tenant.","content":{"application/json":{"example":{"success":false,"message":"Contact code already exists","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/contacts/update-contact":{"post":{"operationId":"post_contacts_update_contact","tags":["Contacts"],"summary":"Update Contact","description":"Updates an existing contact record within the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"contact.update","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"cnt_1","name":"Andi Wijaya","code":"CUST-001","phone":"+6281299998888","status":"Active"},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"code":{"type":"string","minLength":1,"maxLength":100},"firstName":{"type":"string","nullable":true,"maxLength":100},"lastName":{"type":"string","nullable":true,"maxLength":100},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"string","enum":[""]},{"nullable":true}]},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"string","enum":[""]},{"nullable":true}]},"mobile":{"anyOf":[{"type":"string","maxLength":50},{"type":"string","enum":[""]},{"nullable":true}]},"address":{"anyOf":[{"type":"string","maxLength":500},{"type":"string","enum":[""]},{"nullable":true}]},"city":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}]},"state":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}]},"zipCode":{"anyOf":[{"type":"string","maxLength":20},{"type":"string","enum":[""]},{"nullable":true}]},"country":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}]},"gender":{"anyOf":[{"type":"string","maxLength":20},{"type":"string","enum":[""]},{"nullable":true}]},"group":{"anyOf":[{"type":"string","maxLength":100},{"type":"string","enum":[""]},{"nullable":true}]},"notes":{"anyOf":[{"type":"string","maxLength":1000},{"type":"string","enum":[""]},{"nullable":true}]},"status":{"type":"string","enum":["Active","Inactive"],"default":"Active"},"id":{"type":"string","minLength":1}},"required":["name","code","id"]}}}},"responses":{"200":{"description":"OK — Contact updated successfully.","content":{"application/json":{"example":{"success":true,"message":"Contact updated successfully","data":{"id":"cnt_1","name":"Andi Wijaya"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'contact.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"contact.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"contact.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Contact does not exist.","content":{"application/json":{"example":{"success":false,"message":"Contact not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"409":{"description":"Conflict — Duplicate contact code.","content":{"application/json":{"example":{"success":false,"message":"Contact code already exists","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/contacts/delete-contacts":{"post":{"operationId":"post_contacts_delete_contacts","tags":["Contacts"],"summary":"Delete Contacts","description":"Deletes or archives one or more contacts (up to 100 IDs per request) within the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"contact.delete","requestBody":{"required":true,"content":{"application/json":{"example":{"ids":["cnt_1"]},"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":100}},"required":["ids"]}}}},"responses":{"200":{"description":"OK — Contacts deleted successfully.","content":{"application/json":{"example":{"success":true,"message":"Successfully deleted 1 contact(s)","data":{"count":1}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'contact.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"contact.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"contact.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/dashboard/sales-performance":{"post":{"operationId":"post_dashboard_sales_performance","tags":["Dashboard"],"summary":"Get Sales Performance Dashboard","description":"Aggregated realtime dashboard endpoint computing total revenue, top outlets, top products by quantity and revenue, daily charts, recent invoices, and today/date/month/year comparisons based strictly on `Invoice.createdAt`.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"dashboard.view","x-outlet-scoped":"invoice","responses":{"200":{"description":"OK — Aggregated dashboard metrics retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"totalSales":12500000,"bestOutlet":{"outletName":"Outlet Senopati","outletSales":8200000},"topOutlets":[],"bestProductsByQty":[],"bestProductsByRevenue":[],"chartData":[{"date":"2026-11-26","revenue":1450000}],"recentInvoices":[],"invoiceCount":142,"inputStats":{"todayCount":12},"comparisons":{"date":{},"month":{},"year":{}}}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'dashboard.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"dashboard.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"dashboard.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/reports/sales-summary":{"post":{"operationId":"post_reports_sales_summary","tags":["Reports"],"summary":"Get Realtime Sales Summary Report","description":"Generates paginated sales summary rows filtered by server persistence timestamp (`Invoice.createdAt`), outlet scope, and search query.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"reports.view","x-outlet-scoped":"reports","requestBody":{"required":true,"content":{"application/json":{"example":{"startDate":"2026-11-01T00:00:00.000Z","endDate":"2026-11-26T23:59:59.999Z","pageIndex":0,"pageSize":20},"schema":{"type":"object","properties":{"startDate":{"type":"string","format":"date-time"},"endDate":{"type":"string","format":"date-time"},"outletId":{"type":"string","format":"uuid"},"outlet":{"type":"string","maxLength":200},"category":{"type":"string","maxLength":200},"query":{"type":"string","maxLength":200},"pageIndex":{"type":"integer","nullable":true,"minimum":0,"default":0},"pageSize":{"type":"integer","minimum":1,"maximum":100,"default":20}}}}}},"responses":{"200":{"description":"OK — Sales summary report retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"rows":[],"total":0,"totalRevenue":0}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'reports.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"reports.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"reports.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/reports/sales-summary/get-outlet-options":{"post":{"operationId":"post_reports_sales_summary_get_outlet_options","tags":["Reports"],"summary":"Get Outlet Options for Sales Summary","description":"Menu-owned compact endpoint returning accessible outlet filter choices for the Sales Summary report.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"reports.view","x-outlet-scoped":"reports","requestBody":{"required":true,"content":{"application/json":{"example":{"query":""},"schema":{"type":"object","properties":{"query":{"type":"string","maxLength":100}}}}}},"responses":{"200":{"description":"OK — Outlet options retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"options":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'reports.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"reports.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"reports.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/reports/product-sales":{"post":{"operationId":"post_reports_product_sales","tags":["Reports"],"summary":"Get Realtime Product Sales Breakdown","description":"Aggregates sold product quantity and revenue filtered by server persistence timestamp (`Invoice.createdAt`), outlet scope, category, and search query.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"reports.view","x-outlet-scoped":"reports","requestBody":{"required":true,"content":{"application/json":{"example":{"startDate":"2026-11-01T00:00:00.000Z","endDate":"2026-11-26T23:59:59.999Z","category":"Beverages","pageIndex":0,"pageSize":20},"schema":{"type":"object","properties":{"startDate":{"type":"string","format":"date-time"},"endDate":{"type":"string","format":"date-time"},"outletId":{"type":"string","format":"uuid"},"outlet":{"type":"string","maxLength":200},"category":{"type":"string","maxLength":200},"query":{"type":"string","maxLength":200},"pageIndex":{"type":"integer","nullable":true,"minimum":0,"default":0},"pageSize":{"type":"integer","minimum":1,"maximum":100,"default":20}}}}}},"responses":{"200":{"description":"OK — Product sales breakdown retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"rows":[],"total":0}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'reports.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"reports.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"reports.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/reports/product-sales/get-outlet-options":{"post":{"operationId":"post_reports_product_sales_get_outlet_options","tags":["Reports"],"summary":"Get Outlet Options for Product Sales","description":"Menu-owned compact endpoint returning accessible outlet filter choices for the Product Sales report.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"reports.view","x-outlet-scoped":"reports","requestBody":{"required":true,"content":{"application/json":{"example":{"query":""},"schema":{"type":"object","properties":{"query":{"type":"string","maxLength":100}}}}}},"responses":{"200":{"description":"OK — Outlet options retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"options":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'reports.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"reports.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"reports.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/reports/product-sales/get-category-options":{"post":{"operationId":"post_reports_product_sales_get_category_options","tags":["Reports"],"summary":"Get Category Options for Product Sales","description":"Menu-owned compact endpoint returning tenant category filter choices for the Product Sales report.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"reports.view","responses":{"200":{"description":"OK — Category options retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"options":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'reports.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"reports.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"reports.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/users/get-user-list":{"post":{"operationId":"post_users_get_user_list","tags":["Users"],"summary":"Get User List","description":"Retrieves a paginated list of non-archived team users within the authenticated actor's tenant, with optional search, approval status, and active filters.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"users.view","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"","status":"approved","isActive":true,"limit":50,"page":1},"schema":{"type":"object","properties":{"query":{"type":"string"},"status":{"type":"string"},"isActive":{"type":"boolean","nullable":true},"limit":{"type":"integer","minimum":1,"maximum":100,"default":50},"page":{"type":"integer","minimum":1,"default":1}}}}}},"responses":{"200":{"description":"OK — Paginated user list returned successfully.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"users":[{"id":"e4f8b910-1234-4567-89ab-cdef01234567","email":"owner@company.com","username":"owner","name":"Budi Santoso","status":"approved","isActive":true,"role":{"id":"r1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"System Owner"},"userGroup":null,"outlets":[],"createdAt":"2026-01-10T08:00:00.000Z"}],"total":1,"page":1,"limit":50}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'users.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"users.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"users.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/users/create-user":{"post":{"operationId":"post_users_create_user","tags":["Users"],"summary":"Create User","description":"Creates a new user account in Supabase Auth and PostgreSQL within the active tenant. Enforces anti-escalation rules so actors cannot assign roles or permissions above their own level.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"users.create","requestBody":{"required":true,"content":{"application/json":{"example":{"email":"cashier.senopati@invoger.com","username":"cashier_seno","name":"Siti Rahma","password":"SecurePassword123!","roleId":"r2b3c4d5-e6f7-8a9b-0c1d-2e3f4a5b6c7d","status":"approved","isActive":true},"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"username":{"type":"string","nullable":true,"minLength":1,"maxLength":100},"name":{"type":"string","nullable":true,"minLength":1,"maxLength":200},"phone":{"type":"string","nullable":true,"maxLength":30},"status":{"type":"string","enum":["pending","approved","rejected"]},"isActive":{"type":"boolean"},"roleId":{"type":"string","format":"uuid"},"userGroupId":{"type":"string","nullable":true,"format":"uuid"},"outletIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":1000},"password":{"type":"string","minLength":6}},"required":["email","roleId","password"]}}}},"responses":{"201":{"description":"Created — User created and provisioned successfully.","content":{"application/json":{"example":{"success":true,"message":"User created successfully","data":{"id":"c7d8e9f0-1234-5678-9abc-def012345678","email":"cashier.senopati@invoger.com","username":"cashier_seno","name":"Siti Rahma","status":"approved","isActive":true}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Zod validation failed or duplicate email/role error.","content":{"application/json":{"example":{"success":false,"message":"Password must be at least 6 characters","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Lacks 'users.create' or anti-escalation check rejected the target role assignment.","content":{"application/json":{"example":{"success":false,"message":"Forbidden: Cannot assign a System Owner role.","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/users/update-user":{"post":{"operationId":"post_users_update_user","tags":["Users"],"summary":"Update User","description":"Updates profile fields, role assignment, user group, outlet assignments, or password for an existing user in the active tenant. Enforces privilege escalation guards.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"users.update","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"c7d8e9f0-1234-5678-9abc-def012345678","name":"Siti Rahmawati","isActive":true},"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"username":{"type":"string","nullable":true,"minLength":1,"maxLength":100},"name":{"type":"string","nullable":true,"minLength":1,"maxLength":200},"phone":{"type":"string","nullable":true,"maxLength":30},"status":{"type":"string","enum":["pending","approved","rejected"]},"isActive":{"type":"boolean"},"roleId":{"type":"string","nullable":true,"format":"uuid"},"userGroupId":{"type":"string","nullable":true,"format":"uuid"},"outletIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":1000},"password":{"type":"string","minLength":6},"id":{"type":"string","format":"uuid"}},"required":["id"]}}}},"responses":{"200":{"description":"OK — User updated and auth metadata synchronized.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"id":"c7d8e9f0-1234-5678-9abc-def012345678","name":"Siti Rahmawati","isActive":true,"updatedAt":"2026-11-26T11:35:00.000Z"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid payload or target user not found.","content":{"application/json":{"example":{"success":false,"message":"User not found in active tenant","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Missing 'users.update' or privilege escalation blocked.","content":{"application/json":{"example":{"success":false,"message":"Forbidden: Cannot modify a System Owner account.","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/users/set-user-status":{"post":{"operationId":"post_users_set_user_status","tags":["Users"],"summary":"Set User Status","description":"Activates (`isActive: true`) or suspends (`isActive: false`) a user account within the active tenant. Suspended users are rejected on subsequent authenticated requests.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"users.update","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"c7d8e9f0-1234-5678-9abc-def012345678","isActive":false},"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"isActive":{"type":"boolean"}},"required":["id","isActive"]}}}},"responses":{"200":{"description":"OK — User active status updated.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"id":"c7d8e9f0-1234-5678-9abc-def012345678","isActive":false}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid user ID or status change rejected.","content":{"application/json":{"example":{"success":false,"message":"User not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'users.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"users.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"users.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/users/archive-users":{"post":{"operationId":"post_users_archive_users","tags":["Users"],"summary":"Archive Users","description":"Soft-archives one or more user accounts (`isArchived: true`, up to 100 IDs per request) within the active tenant. Archived users lose all session access immediately.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"users.delete","requestBody":{"required":true,"content":{"application/json":{"example":{"ids":["c7d8e9f0-1234-5678-9abc-def012345678"]},"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100}},"required":["ids"]}}}},"responses":{"200":{"description":"OK — Users archived successfully.","content":{"application/json":{"example":{"success":true,"message":"Users archived successfully","data":{"count":1}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid UUID list or archive failure.","content":{"application/json":{"example":{"success":false,"message":"Failed to archive users","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'users.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"users.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"users.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/users/get-outlet-list":{"post":{"operationId":"post_users_get_outlet_list","tags":["Users"],"summary":"Get Outlet Options for Users","description":"Menu-owned endpoint returning outlet choices scoped to the actor's outlet permissions for user assignment forms.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"users.view","x-outlet-scoped":"outlet","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"","limit":20,"page":1},"schema":{"type":"object","properties":{"id":{"type":"string"},"query":{"type":"string"},"limit":{"type":"number","minimum":1,"maximum":1000,"default":20},"page":{"type":"number","minimum":1,"default":1}}}}}},"responses":{"200":{"description":"OK — Outlet options retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"outlets":[],"total":0}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'users.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"users.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"users.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/users/get-role-list":{"post":{"operationId":"post_users_get_role_list","tags":["Users"],"summary":"Get Role Options for Users","description":"Menu-owned endpoint returning tenant role options for user assignment dropdowns.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"users.view","requestBody":{"required":true,"content":{"application/json":{"example":{"limit":100,"page":1},"schema":{"type":"object","properties":{"query":{"type":"string"},"limit":{"type":"number","minimum":1,"maximum":100,"default":100},"page":{"type":"number","minimum":1,"default":1}}}}}},"responses":{"200":{"description":"OK — Role options retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"roles":[],"total":0}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'users.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"users.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"users.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/users/get-user-group-list":{"post":{"operationId":"post_users_get_user_group_list","tags":["Users"],"summary":"Get User Group Options for Users","description":"Menu-owned endpoint returning user group options within the active tenant for user assignment dialogs.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"users.view","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"","limit":100,"page":1},"schema":{"type":"object","properties":{"query":{"type":"string"},"limit":{"type":"number","minimum":1,"maximum":100,"default":100},"page":{"type":"number","minimum":1,"default":1}}}}}},"responses":{"200":{"description":"OK — User group options retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"userGroups":[],"total":0}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'users.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"users.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"users.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/roles/get-role-list":{"post":{"operationId":"post_roles_get_role_list","tags":["Roles"],"summary":"Get Role List","description":"Retrieves paginated RBAC roles configured for the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"roles.view","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"","limit":100,"page":1},"schema":{"type":"object","properties":{"query":{"type":"string"},"limit":{"type":"number","minimum":1,"maximum":100,"default":100},"page":{"type":"number","minimum":1,"default":1}}}}}},"responses":{"200":{"description":"OK — Role list retrieved successfully.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"roles":[{"id":"r1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Cashier","isSystem":false}],"total":1}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'roles.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"roles.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"roles.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/roles/get-role-detail":{"post":{"operationId":"post_roles_get_role_detail","tags":["Roles"],"summary":"Get Role Detail","description":"Fetches full role details including granted module/action permissions for editing.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"roles.view","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"r1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"},"schema":{"$ref":"#/components/schemas/RoleDetailRequest"}}}},"responses":{"200":{"description":"OK — Role detail retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"id":"r1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Cashier","permissions":[{"module":"invoice","action":"create"},{"module":"invoice","action":"view"}]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'roles.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"roles.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"roles.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Role does not exist in the active tenant.","content":{"application/json":{"example":{"success":false,"message":"Role not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/roles/create-role":{"post":{"operationId":"post_roles_create_role","tags":["Roles"],"summary":"Create Role","description":"Creates a new custom RBAC role in the active tenant. Enforces anti-escalation rules so actors cannot grant permissions they do not hold.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"roles.create","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"Store Cashier","dataScope":"own","scopedModules":"invoice,inventory","permissions":[{"module":"invoice","action":"create"},{"module":"invoice","action":"view"}]},"schema":{"type":"object","properties":{"ID":{"type":"string"},"id":{"type":"string"},"name":{"type":"string","minLength":1},"dataScope":{"type":"string","enum":["all","own"],"default":"all"},"scopedModules":{"type":"string","default":""},"permissions":{"type":"array","items":{"type":"object","properties":{"module":{"type":"string","enum":["dashboard","product","inventory","invoice","outlet","promotion","settings","users","roles","user_groups","reports","contact","integrations"]},"action":{"type":"string","enum":["view","create","update","delete","archive","view_list","view_detail"]}},"required":["module","action"]}}},"required":["name","permissions"]}}}},"responses":{"201":{"description":"Created — Role created successfully.","content":{"application/json":{"example":{"success":true,"message":"Role created successfully","data":{"id":"r2b3c4d5-e6f7-8a9b-0c1d-2e3f4a5b6c7d","name":"Store Cashier"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Validation error or duplicate role name.","content":{"application/json":{"example":{"success":false,"message":"Role name already exists","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Lacks 'roles.create' or permission escalation rejected.","content":{"application/json":{"example":{"success":false,"message":"Forbidden: Cannot grant permissions not held by your account.","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/roles/update-role":{"post":{"operationId":"post_roles_update_role","tags":["Roles"],"summary":"Update Role","description":"Updates an existing custom role's name, scope, and permission matrix, then invalidates tenant permission caches.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"roles.update","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"r2b3c4d5-e6f7-8a9b-0c1d-2e3f4a5b6c7d","name":"Senior Cashier","dataScope":"all","scopedModules":"","permissions":[{"module":"invoice","action":"create"},{"module":"invoice","action":"view"}]},"schema":{"type":"object","properties":{"ID":{"type":"string"},"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"dataScope":{"type":"string","enum":["all","own"],"default":"all"},"scopedModules":{"type":"string","default":""},"permissions":{"type":"array","items":{"type":"object","properties":{"module":{"type":"string","enum":["dashboard","product","inventory","invoice","outlet","promotion","settings","users","roles","user_groups","reports","contact","integrations"]},"action":{"type":"string","enum":["view","create","update","delete","archive","view_list","view_detail"]}},"required":["module","action"]}}},"required":["id","name","permissions"]}}}},"responses":{"200":{"description":"OK — Role updated successfully.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"id":"r2b3c4d5-e6f7-8a9b-0c1d-2e3f4a5b6c7d","name":"Senior Cashier"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Validation failure or role not found.","content":{"application/json":{"example":{"success":false,"message":"Invalid role update payload","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'roles.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"roles.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"roles.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/roles/delete-roles":{"post":{"operationId":"post_roles_delete_roles","tags":["Roles"],"summary":"Delete Roles","description":"Deletes one or more custom non-system roles within the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"roles.delete","requestBody":{"required":true,"content":{"application/json":{"example":{"ids":["r2b3c4d5-e6f7-8a9b-0c1d-2e3f4a5b6c7d"]},"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100}},"required":["ids"]}}}},"responses":{"200":{"description":"OK — Roles deleted.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"success":true}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Cannot delete system role or role still assigned to users.","content":{"application/json":{"example":{"success":false,"message":"Cannot delete a system role","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'roles.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"roles.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"roles.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/user-groups/get-user-group-list":{"post":{"operationId":"post_user_groups_get_user_group_list","tags":["User Groups"],"summary":"Get User Group List","description":"Retrieves paginated user groups within the active tenant, including outlet restrictions and scoped modules.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"user_groups.view","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"","limit":100,"page":1},"schema":{"type":"object","properties":{"query":{"type":"string"},"limit":{"type":"number","minimum":1,"maximum":100,"default":100},"page":{"type":"number","minimum":1,"default":1}}}}}},"responses":{"200":{"description":"OK — User group list retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"userGroups":[{"id":"g1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Senopati Staff","dataScope":"restricted","scopedModules":"invoice,inventory"}],"total":1}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'user_groups.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"user_groups.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"user_groups.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/user-groups/create-user-group":{"post":{"operationId":"post_user_groups_create_user_group","tags":["User Groups"],"summary":"Create User Group","description":"Creates a new user group defining outlet assignments, data scope (`all` or `restricted`), scoped modules, and initial members.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"user_groups.create","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"Senopati Outlet Team","description":"Restricted access for Outlet Senopati cashiers","outletIds":["o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"],"dataScope":"restricted","scopedModules":"invoice,inventory,product"},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":150},"description":{"type":"string","nullable":true,"maxLength":500},"outletIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":1000},"dataScope":{"type":"string","enum":["all","restricted"],"default":"restricted"},"scopedModules":{"type":"string","maxLength":500,"default":""},"memberUserIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":500}},"required":["name"]}}}},"responses":{"201":{"description":"Created — User group created successfully.","content":{"application/json":{"example":{"success":true,"message":"User group created successfully","data":{"id":"g1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Senopati Outlet Team"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid outlet IDs or duplicate group name.","content":{"application/json":{"example":{"success":false,"message":"One or more outlet IDs do not belong to active tenant","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'user_groups.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"user_groups.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"user_groups.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/user-groups/update-user-group":{"post":{"operationId":"post_user_groups_update_user_group","tags":["User Groups"],"summary":"Update User Group","description":"Updates an existing user group's outlet assignments and scoped modules, then invalidates affected users' outlet/scope caches.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"user_groups.update","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"g1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Senopati & Kemang Team","dataScope":"restricted"},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":150},"description":{"type":"string","nullable":true,"maxLength":500},"outletIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":1000},"dataScope":{"type":"string","enum":["all","restricted"],"default":"restricted"},"scopedModules":{"type":"string","maxLength":500,"default":""},"id":{"type":"string","format":"uuid"}},"required":["id"]}}}},"responses":{"200":{"description":"OK — User group updated successfully.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"id":"g1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Senopati & Kemang Team"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid ID or cross-tenant outlet rejection.","content":{"application/json":{"example":{"success":false,"message":"User group not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'user_groups.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"user_groups.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"user_groups.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/user-groups/delete-user-groups":{"post":{"operationId":"post_user_groups_delete_user_groups","tags":["User Groups"],"summary":"Delete User Groups","description":"Deletes one or more user groups within the active tenant and clears related scope caches.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"user_groups.delete","requestBody":{"required":true,"content":{"application/json":{"example":{"ids":["g1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"]},"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100}},"required":["ids"]}}}},"responses":{"200":{"description":"OK — User groups deleted successfully.","content":{"application/json":{"example":{"success":true,"message":"User groups deleted successfully","data":{"count":1}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'user_groups.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"user_groups.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"user_groups.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/print-settings/get-outlet-list":{"post":{"operationId":"post_print_settings_get_outlet_list","tags":["Print Settings"],"summary":"Get Outlets for Print Settings","description":"Lists outlets and their current thermal receipt header/footer print configurations, scoped by outlet permissions.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"settings.view","x-outlet-scoped":"outlet","requestBody":{"required":true,"content":{"application/json":{"example":{"query":"","limit":20,"page":1},"schema":{"type":"object","properties":{"id":{"type":"string"},"query":{"type":"string"},"limit":{"type":"number","minimum":1,"maximum":1000,"default":20},"page":{"type":"number","minimum":1,"default":1}}}}}},"responses":{"200":{"description":"OK — Outlets with print template state retrieved.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"outlets":[{"id":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Outlet Senopati","header":[],"footer":[]}],"total":1}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'settings.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"settings.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"settings.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/print-settings/save-template":{"post":{"operationId":"post_print_settings_save_template","tags":["Print Settings"],"summary":"Save Print Template","description":"Atomically saves custom thermal receipt header and footer blocks for an outlet in both `PrintTemplate` and `Outlet` records.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"settings.update","x-outlet-scoped":"outlet","requestBody":{"required":true,"content":{"application/json":{"example":{"outletId":"o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","header":[{"text":"INVOGER FLAGSHIP","bold":true}],"footer":[{"text":"Thank you for visiting!"}]},"schema":{"$ref":"#/components/schemas/SavePrintTemplateRequest"}}}},"responses":{"200":{"description":"OK — Template saved successfully.","content":{"application/json":{"example":{"success":true,"message":"Template saved successfully","data":{"id":"tpl_01"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'settings.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"settings.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"settings.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Outlet not found in active tenant.","content":{"application/json":{"example":{"success":false,"message":"Outlet not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/print-settings/delete-templates":{"post":{"operationId":"post_print_settings_delete_templates","tags":["Print Settings"],"summary":"Reset Print Templates","description":"Deletes custom print template rows and resets receipt header/footer configurations for up to 100 outlets.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"settings.update","x-outlet-scoped":"outlet","requestBody":{"required":true,"content":{"application/json":{"example":{"outletIds":["o1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"]},"schema":{"$ref":"#/components/schemas/DeletePrintTemplatesRequest"}}}},"responses":{"200":{"description":"OK — Print settings reset successfully.","content":{"application/json":{"example":{"success":true,"message":"Print settings reset successfully","data":{"count":1}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'settings.update' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"settings.update\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"settings.update"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — One or more outlets were not found.","content":{"application/json":{"example":{"success":false,"message":"One or more outlets were not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/integrations/oauth2/token":{"post":{"operationId":"post_integrations_oauth2_token","tags":["Integrations"],"summary":"Exchange OAuth2 Client Credentials","description":"Issues short-lived scoped OAuth2 access tokens via `client_credentials` grant (`client_id` + `client_secret`). Accepts JSON, `application/x-www-form-urlencoded`, or HTTP Basic Auth. Rate-limited per IP and per client (`Cache-Control: no-store`).","security":[],"x-auth":"oauth2_client","requestBody":{"required":true,"content":{"application/json":{"example":{"client_id":"inv_client_998123","client_secret":"inv_secret_••••","grant_type":"client_credentials","scope":"invoice.create product.view"},"schema":{"type":"object","properties":{"client_id":{"type":"string","minLength":1,"maxLength":128},"client_secret":{"type":"string","minLength":1,"maxLength":256},"grant_type":{"type":"string","enum":["client_credentials"],"default":"client_credentials"},"scope":{"type":"string","maxLength":1000}},"required":["client_id","client_secret"]}}}},"responses":{"200":{"description":"OK — Scoped OAuth2 access token issued.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"access_token":"eyJhbGciOiJIUzI1NiIs...","token_type":"Bearer","expires_in":3600,"scope":"invoice.create product.view","scopes":["invoice.create","product.view"],"client_id":"inv_client_998123"}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Invalid client_id or client_secret.","content":{"application/json":{"example":{"success":false,"message":"Invalid client_id or client_secret","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"429":{"description":"Too Many Requests — OAuth2 token exchange rate limit exceeded.","content":{"application/json":{"example":{"success":false,"message":"Too many OAuth2 token requests","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/integrations/get-rate-limit":{"post":{"operationId":"post_integrations_get_rate_limit","tags":["Integrations"],"summary":"Get Caller Rate Limit Status","description":"Peeks at the authenticated caller's current rate-limit quota and reset window without consuming quota.","security":[{"bearerAuth":[]}],"x-auth":"bearer","responses":{"200":{"description":"OK — Current rate-limit telemetry retrieved.","content":{"application/json":{"example":{"success":true,"message":"Rate limit status retrieved successfully","data":{"authMethod":"integration_token","limit":240,"remaining":238,"resetInSeconds":45,"windowSeconds":60}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/integrations/get-integrations":{"post":{"operationId":"post_integrations_get_integrations","tags":["Integrations"],"summary":"List Integration Tokens","description":"Lists active and historical M2M integration tokens (`inv_live_...`) for the tenant. Requires interactive user session (blocked for M2M tokens).","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.view","responses":{"200":{"description":"OK — Integration tokens listed.","content":{"application/json":{"example":{"success":true,"message":"Success","data":{"tokens":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/integrations/create-token":{"post":{"operationId":"post_integrations_create_token","tags":["Integrations"],"summary":"Create Integration Token","description":"Creates a scoped machine-to-machine integration token (`inv_live_...`). Caller cannot grant scopes absent from their own role permissions. Denied for M2M token callers.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.create","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"Claude Desktop MCP","scopes":["invoice.create","invoice.view","product.view"],"expiresInDays":90},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"scopes":{"type":"array","items":{"type":"string","enum":["invoice.create","invoice.view","invoice.delete","outlet.view","product.view","inventory.view","inventory.update","reports.view","dashboard.view","promotion.view","contact.view","users.view"]},"minItems":1,"default":["invoice.create","invoice.view","outlet.view","product.view"]},"expiresInDays":{"anyOf":[{"type":"integer","minimum":1,"maximum":365},{"nullable":true}]}},"required":["name"]}}}},"responses":{"200":{"description":"OK — Token created (plaintext secret returned once).","content":{"application/json":{"example":{"success":true,"message":"Integration token generated successfully","data":{"id":"tok_1","name":"Claude Desktop MCP","plainToken":"inv_live_9876543210...","scopes":["invoice.create","product.view"]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/integrations/revoke-token":{"post":{"operationId":"post_integrations_revoke_token","tags":["Integrations"],"summary":"Revoke Integration Token","description":"Immediately revokes an active M2M integration token within the tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.delete","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"t1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"},"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]}}}},"responses":{"200":{"description":"OK — Token revoked successfully.","content":{"application/json":{"example":{"success":true,"message":"Token revoked successfully","data":null},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Token not found or already revoked.","content":{"application/json":{"example":{"success":false,"message":"Token not found or already revoked","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/integrations/get-oauth-clients":{"post":{"operationId":"post_integrations_get_oauth_clients","tags":["Integrations"],"summary":"List OAuth2 Clients","description":"Lists OAuth2 M2M applications registered in the active tenant. Interactive user session required.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.view","responses":{"200":{"description":"OK — OAuth2 clients listed.","content":{"application/json":{"example":{"success":true,"message":"OAuth2 clients retrieved successfully","data":{"clients":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/integrations/create-oauth-client":{"post":{"operationId":"post_integrations_create_oauth_client","tags":["Integrations"],"summary":"Create OAuth2 Client","description":"Registers a new OAuth2 `client_credentials` application with scoped permissions, custom rate limit, and token TTL.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.create","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"ERP Sync Worker","scopes":["invoice.view","product.view"],"rateLimitPerMin":240,"tokenTtlSeconds":3600},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"scopes":{"type":"array","items":{"type":"string","enum":["invoice.create","invoice.view","invoice.delete","outlet.view","product.view","inventory.view","inventory.update","reports.view","dashboard.view","promotion.view","contact.view","users.view"]},"minItems":1,"default":["invoice.create","invoice.view","outlet.view","product.view"]},"rateLimitPerMin":{"type":"integer","minimum":30,"maximum":1200,"default":240},"tokenTtlSeconds":{"type":"integer","minimum":300,"maximum":86400,"default":3600}},"required":["name"]}}}},"responses":{"200":{"description":"OK — OAuth2 client created (client secret shown once).","content":{"application/json":{"example":{"success":true,"message":"OAuth2 client created successfully","data":{"id":"c1a2b3c4","clientId":"inv_client_998123","clientSecret":"inv_secret_..."}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/integrations/rotate-oauth-secret":{"post":{"operationId":"post_integrations_rotate_oauth_secret","tags":["Integrations"],"summary":"Rotate OAuth2 Client Secret","description":"Regenerates the `client_secret` for an existing OAuth2 M2M application and invalidates the previous secret.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.create","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"c1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"},"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]}}}},"responses":{"200":{"description":"OK — Client secret rotated.","content":{"application/json":{"example":{"success":true,"message":"OAuth2 client secret rotated","data":{"clientId":"inv_client_998123","clientSecret":"inv_secret_new..."}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — OAuth2 client not found.","content":{"application/json":{"example":{"success":false,"message":"OAuth2 client not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/integrations/revoke-oauth-client":{"post":{"operationId":"post_integrations_revoke_oauth_client","tags":["Integrations"],"summary":"Revoke OAuth2 Client","description":"Permanently disables an OAuth2 M2M application so it can no longer exchange tokens.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.delete","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"c1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"},"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]}}}},"responses":{"200":{"description":"OK — OAuth2 client revoked.","content":{"application/json":{"example":{"success":true,"message":"OAuth2 client revoked","data":null},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — OAuth2 client not found.","content":{"application/json":{"example":{"success":false,"message":"OAuth2 client not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/integrations/get-webhooks":{"post":{"operationId":"post_integrations_get_webhooks","tags":["Integrations"],"summary":"List Webhook Subscriptions","description":"Lists outbound webhook subscriptions configured in the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.view","responses":{"200":{"description":"OK — Webhook subscriptions listed.","content":{"application/json":{"example":{"success":true,"message":"Webhook subscriptions retrieved successfully","data":{"subscriptions":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/integrations/create-webhook":{"post":{"operationId":"post_integrations_create_webhook","tags":["Integrations"],"summary":"Create Webhook Subscription","description":"Registers a new outbound HTTPS webhook endpoint with SSRF protection, HMAC-SHA256 signing secret, event selection, and retry count.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.create","requestBody":{"required":true,"content":{"application/json":{"example":{"name":"Order Events","url":"https://my-app.com/webhooks/invoger","events":["invoice.created","invoice.voided"],"logMode":"Full","maxRetries":2},"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"url":{"type":"string","maxLength":500,"format":"uri"},"events":{"type":"array","items":{"type":"string","enum":["invoice.created","invoice.voided","product.created","product.updated","inventory.adjusted","outlet.created"]},"minItems":1},"logMode":{"type":"string","enum":["Full","Error","None"],"default":"Full"},"customUserAgent":{"type":"string","nullable":true,"maxLength":120},"maxRetries":{"type":"integer","nullable":true,"minimum":0,"maximum":3,"default":1}},"required":["name","url","events"]}}}},"responses":{"200":{"description":"OK — Webhook subscription created.","content":{"application/json":{"example":{"success":true,"message":"Webhook registered successfully","data":{"id":"w1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","name":"Order Events","signingSecret":"whsec_..."}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/integrations/update-webhook":{"post":{"operationId":"post_integrations_update_webhook","tags":["Integrations"],"summary":"Update Webhook Subscription","description":"Updates an existing webhook subscription's URL, subscribed events, retry settings, active flag, or rotates its signing secret.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.create","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"w1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","isActive":true,"rotateSecret":false},"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":100},"url":{"type":"string","maxLength":500,"format":"uri"},"events":{"type":"array","items":{"type":"string","enum":["invoice.created","invoice.voided","product.created","product.updated","inventory.adjusted","outlet.created"]},"minItems":1},"logMode":{"type":"string","enum":["Full","Error","None"]},"customUserAgent":{"type":"string","nullable":true,"maxLength":120},"maxRetries":{"type":"integer","nullable":true,"minimum":0,"maximum":3},"isActive":{"type":"boolean"},"rotateSecret":{"type":"boolean"}},"required":["id"]}}}},"responses":{"200":{"description":"OK — Webhook updated.","content":{"application/json":{"example":{"success":true,"message":"Webhook updated successfully","data":{"id":"w1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c","isActive":true}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Webhook subscription not found.","content":{"application/json":{"example":{"success":false,"message":"Webhook subscription not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/integrations/delete-webhook":{"post":{"operationId":"post_integrations_delete_webhook","tags":["Integrations"],"summary":"Delete Webhook Subscription","description":"Deletes a webhook subscription from the active tenant.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.delete","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"w1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"},"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]}}}},"responses":{"200":{"description":"OK — Webhook deleted.","content":{"application/json":{"example":{"success":true,"message":"Webhook deleted successfully","data":null},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.delete' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.delete\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.delete"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Webhook subscription not found.","content":{"application/json":{"example":{"success":false,"message":"Webhook subscription not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/integrations/test-webhook":{"post":{"operationId":"post_integrations_test_webhook","tags":["Integrations"],"summary":"Test Webhook Delivery","description":"Dispatches a signed synthetic test event to the target webhook subscription and returns delivery HTTP status and timing.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.create","requestBody":{"required":true,"content":{"application/json":{"example":{"id":"w1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c"},"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]}}}},"responses":{"200":{"description":"OK — Test webhook delivery attempted.","content":{"application/json":{"example":{"success":true,"message":"Webhook test event dispatched","data":{"status":"success","httpStatus":200,"attemptCount":1,"durationMs":124}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.create' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.create\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.create"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}},"404":{"description":"Not Found — Webhook subscription not found.","content":{"application/json":{"example":{"success":false,"message":"Webhook subscription not found","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/integrations/get-webhook-deliveries":{"post":{"operationId":"post_integrations_get_webhook_deliveries","tags":["Integrations"],"summary":"List Webhook Delivery Logs","description":"Retrieves recent webhook delivery attempts filtered by subscription ID, event type, or delivery outcome.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.view","requestBody":{"required":true,"content":{"application/json":{"example":{"event":"invoice.created","status":"success","limit":30},"schema":{"type":"object","properties":{"subscriptionId":{"type":"string","format":"uuid"},"event":{"type":"string","maxLength":64},"status":{"type":"string","enum":["success","failed"]},"limit":{"type":"integer","minimum":1,"maximum":100,"default":30}}}}}},"responses":{"200":{"description":"OK — Webhook deliveries retrieved.","content":{"application/json":{"example":{"success":true,"message":"Webhook deliveries retrieved successfully","data":{"deliveries":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/integrations/get-audit-logs":{"post":{"operationId":"post_integrations_get_audit_logs","tags":["Integrations"],"summary":"Get Security Audit Logs","description":"Returns sanitized security audit events for the active tenant (restricted to interactive users holding `users.view`).","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"users.view","requestBody":{"required":true,"content":{"application/json":{"example":{"event":"auth.login","outcome":"success","limit":50},"schema":{"type":"object","properties":{"event":{"type":"string","maxLength":80},"outcome":{"type":"string","enum":["success","denied","failure"]},"limit":{"type":"integer","minimum":1,"maximum":200,"default":50}}}}}},"responses":{"200":{"description":"OK — Security audit logs retrieved.","content":{"application/json":{"example":{"success":true,"message":"Security audit logs retrieved successfully","data":{"items":[],"total":0}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'users.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"users.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"users.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/integrations/get-dashboard-summary":{"post":{"operationId":"post_integrations_get_dashboard_summary","tags":["Integrations"],"summary":"Get Integrations Dashboard Summary","description":"Unified integrations telemetry across tokens, OAuth2 clients, webhooks, deliveries, and (when authorized) security audit events.","security":[{"bearerAuth":[]}],"x-auth":"bearer","x-permission":"integrations.view","requestBody":{"required":true,"content":{"application/json":{"example":{"category":"webhooks","limit":100},"schema":{"type":"object","properties":{"category":{"type":"string","enum":["agent-token","oauth","webhooks","deliveries","security-audit"]},"status":{"type":"string","enum":["success","denied","failure","info"]},"limit":{"type":"integer","minimum":1,"maximum":200,"default":100}}}}}},"responses":{"200":{"description":"OK — Integrations dashboard summary retrieved.","content":{"application/json":{"example":{"success":true,"message":"Integration dashboard summary retrieved successfully","data":{"counts":{},"events":[]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"403":{"description":"Forbidden — Caller lacks required permission 'integrations.view' or tenant/outlet access.","content":{"application/json":{"example":{"success":false,"code":"MISSING_PERMISSION","status":"Forbidden","message":"Role \"Cashier\" does not have permission \"integrations.view\".","data":{"allowed":false,"role":"Cashier","requiredPermission":"integrations.view"}},"schema":{"$ref":"#/components/schemas/ForbiddenPermissionErrorResponse"}}}}}}},"/api/mcp":{"post":{"operationId":"post_mcp","tags":["MCP"],"summary":"Execute MCP JSON-RPC Request","description":"Streamable HTTP transport endpoint for the Model Context Protocol (MCP). Requires an `inv_live_...` integration token via `Authorization: Bearer` or `X-Invoger-Token` and `integrations.view` permission. Rate-limited per IP and bound strictly to the token's tenant & outlet scope.","security":[{"bearerAuth":[]},{"integrationTokenHeader":[]}],"x-auth":"mcp_token","x-permission":"integrations.view","requestBody":{"required":true,"content":{"application/json":{"example":{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_invoicing_config","arguments":{}}},"schema":{"$ref":"#/components/schemas/McpJsonRpcRequest"}}}},"responses":{"200":{"description":"OK — JSON-RPC 2.0 tool execution or initialization result.","content":{"application/json":{"example":{"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"{\"outlets\": [...]}"}]}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"jsonrpc":"2.0","error":{"code":-32000,"message":"Unauthorized: Missing Invoger integration token. Provide 'Authorization: Bearer <token>' or 'X-Invoger-Token'."},"id":null},"schema":{"$ref":"#/components/schemas/McpJsonRpcErrorResponse"}}}},"403":{"description":"Forbidden — Integration token role lacks 'integrations.view' permission.","content":{"application/json":{"example":{"jsonrpc":"2.0","error":{"code":-32001,"message":"Forbidden: User role \"Cashier\" does not have required permission \"integrations.view\" to access MCP services."},"id":null},"schema":{"$ref":"#/components/schemas/McpJsonRpcErrorResponse"}}}},"429":{"description":"Too Many Requests — MCP IP rate limit exceeded.","content":{"application/json":{"example":{"jsonrpc":"2.0","error":{"code":-32000,"message":"Too many MCP requests. Please slow down and try again."},"id":null},"schema":{"$ref":"#/components/schemas/McpJsonRpcErrorResponse"}}}}}},"get":{"operationId":"get_mcp","tags":["MCP"],"summary":"Open MCP Streamable SSE Session","description":"Establishes an authenticated MCP server-sent event (SSE) transport stream using `Authorization: Bearer <inv_live_...>` or `X-Invoger-Token`.","security":[{"bearerAuth":[]},{"integrationTokenHeader":[]}],"x-auth":"mcp_token","x-permission":"integrations.view","responses":{"200":{"description":"OK — SSE / Streamable HTTP session opened.","content":{"text/event-stream":{"example":"event: endpoint\ndata: /api/mcp\n\n","schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"jsonrpc":"2.0","error":{"code":-32000,"message":"Unauthorized: Missing Invoger integration token. Provide 'Authorization: Bearer <token>' or 'X-Invoger-Token'."},"id":null},"schema":{"$ref":"#/components/schemas/McpJsonRpcErrorResponse"}}}},"403":{"description":"Forbidden — Token lacks 'integrations.view' permission.","content":{"application/json":{"example":{"jsonrpc":"2.0","error":{"code":-32001,"message":"Forbidden: Missing required permission \"integrations.view\"."},"id":null},"schema":{"$ref":"#/components/schemas/McpJsonRpcErrorResponse"}}}}}},"delete":{"operationId":"delete_mcp","tags":["MCP"],"summary":"Close MCP Streamable Session","description":"Terminates an active Streamable HTTP MCP transport session.","security":[{"bearerAuth":[]},{"integrationTokenHeader":[]}],"x-auth":"mcp_token","x-permission":"integrations.view","responses":{"200":{"description":"OK — MCP session terminated.","content":{"application/json":{"example":{"jsonrpc":"2.0","id":null,"result":{}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"jsonrpc":"2.0","error":{"code":-32000,"message":"Unauthorized: Missing Invoger integration token. Provide 'Authorization: Bearer <token>' or 'X-Invoger-Token'."},"id":null},"schema":{"$ref":"#/components/schemas/McpJsonRpcErrorResponse"}}}},"403":{"description":"Forbidden — Token lacks 'integrations.view' permission.","content":{"application/json":{"example":{"jsonrpc":"2.0","error":{"code":-32001,"message":"Forbidden: Missing required permission \"integrations.view\"."},"id":null},"schema":{"$ref":"#/components/schemas/McpJsonRpcErrorResponse"}}}}}},"options":{"operationId":"options_mcp","tags":["MCP"],"summary":"MCP CORS Preflight","description":"Handles CORS preflight requests for MCP clients using configured `MCP_ALLOWED_ORIGIN` or same-origin checks.","security":[],"x-auth":"none","responses":{"204":{"description":"No Content — Preflight headers returned."}}}},"/api/openapi":{"get":{"operationId":"get_openapi","tags":["OpenAPI"],"summary":"Get OpenAPI 3.0.3 Specification","description":"Returns the dynamically compiled Single-Source-of-Truth OpenAPI 3.0.3 specification generated from InvogerPOS Zod validation schemas and endpoint registry. Supports JSON (default) and `?format=yaml`.","security":[],"x-auth":"none","parameters":[{"schema":{"type":"string","enum":["json","yaml"],"description":"Optional output format: 'json' (default) or 'yaml'.","example":"json"},"required":false,"description":"Optional output format: 'json' (default) or 'yaml'.","name":"format","in":"query"}],"responses":{"200":{"description":"OK — OpenAPI 3.0.3 specification document returned.","content":{"application/json":{"example":{"openapi":"3.0.3","info":{"title":"InvogerPOS API","version":"1.2.0"},"paths":{}},"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}}}}},"/api/platform/get-overview":{"post":{"operationId":"post_platform_get_overview","tags":["Platform Console"],"summary":"Get Founder platform overview metrics","description":"Returns cross-tenant tenant counts, 24h/30d invoice activity, PostgreSQL database footprint, 14-day daily chart series, and recent signups for verified Platform Founders.","security":[{"bearerAuth":[]}],"x-auth":"bearer","responses":{"200":{"description":"Platform telemetry overview loaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/platform/get-tenant-list":{"post":{"operationId":"post_platform_get_tenant_list","tags":["Platform Console"],"summary":"List registered tenant workspaces","description":"Returns a paginated and filterable directory of all tenant workspaces, owner contacts, plans, status flags, and entity counts.","security":[{"bearerAuth":[]}],"x-auth":"bearer","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformTenantListRequest"}}}},"responses":{"200":{"description":"Paginated tenant directory loaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericSuccessResponse"}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}},"/api/platform/update-tenant":{"post":{"operationId":"post_platform_update_tenant","tags":["Platform Console"],"summary":"Update tenant status, plan, or custom domain","description":"Allows verified Platform Founders to suspend or reactivate a workspace, update subscription plan tier, or bind a custom white-label hostname.","security":[{"bearerAuth":[]}],"x-auth":"bearer","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformTenantUpdateRequest"}}}},"responses":{"200":{"description":"Tenant updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true],"description":"Indicates the API operation succeeded.","example":true},"message":{"type":"string","description":"Human-readable response status message.","example":"Tenant workspace updated"},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"subdomain":{"type":"string","nullable":true},"customDomain":{"type":"string","nullable":true},"plan":{"type":"string"},"status":{"type":"string"}},"required":["id","name","subdomain","customDomain","plan","status"]}},"required":["success","message","data"]}}}},"400":{"description":"Bad Request — Invalid request format or Zod schema validation failed.","content":{"application/json":{"example":{"success":false,"message":"Validation failed","errors":{"_errors":[]}},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"401":{"description":"Unauthorized — Missing, invalid, or expired Bearer token.","content":{"application/json":{"example":{"success":false,"message":"Unauthorized","errors":null},"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"404":{"description":"Target tenant workspace not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}},"409":{"description":"Custom domain is already assigned to another workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiErrorResponse"}}}}}}}}}