{"openapi":"3.0.0","paths":{"/api/v1/health":{"get":{"operationId":"HealthController_health","parameters":[],"responses":{"200":{"description":""}},"tags":["health"]}},"/api/v1/auth/register":{"post":{"operationId":"AuthController_register","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterDto"}}}},"responses":{"201":{"description":""}},"summary":"Create an account + business (14-day trial). Sends an email verification code.","tags":["auth"]}},"/api/v1/auth/verify-email":{"post":{"operationId":"AuthController_verify","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyEmailDto"}}}},"responses":{"200":{"description":""}},"tags":["auth"]}},"/api/v1/auth/resend-code":{"post":{"operationId":"AuthController_resend","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDto"}}}},"responses":{"200":{"description":""}},"tags":["auth"]}},"/api/v1/auth/login":{"post":{"operationId":"AuthController_login","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginDto"}}}},"responses":{"200":{"description":""}},"tags":["auth"]}},"/api/v1/auth/refresh":{"post":{"operationId":"AuthController_refresh","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshDto"}}}},"responses":{"200":{"description":""}},"tags":["auth"]}},"/api/v1/auth/logout":{"post":{"operationId":"AuthController_logout","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshDto"}}}},"responses":{"200":{"description":""}},"tags":["auth"]}},"/api/v1/auth/forgot-password":{"post":{"operationId":"AuthController_forgot","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDto"}}}},"responses":{"200":{"description":""}},"tags":["auth"]}},"/api/v1/auth/reset-password":{"post":{"operationId":"AuthController_reset","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPasswordDto"}}}},"responses":{"200":{"description":""}},"tags":["auth"]}},"/api/v1/auth/change-password":{"post":{"operationId":"AuthController_change","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePasswordDto"}}}},"responses":{"200":{"description":""}},"tags":["auth"]}},"/api/v1/auth/google":{"get":{"operationId":"AuthController_google","parameters":[{"name":"client","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"Starts Google sign-in. `?client=web|mobile|desktop` decides where the user lands afterwards.","tags":["auth"]}},"/api/v1/auth/google/callback":{"get":{"operationId":"AuthController_googleCallback","parameters":[{"name":"code","required":true,"in":"query","schema":{"type":"string"}},{"name":"state","required":true,"in":"query","schema":{"type":"string"}},{"name":"error","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["auth"]}},"/api/v1/auth/exchange":{"post":{"operationId":"AuthController_exchange","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeDto"}}}},"responses":{"200":{"description":""}},"summary":"Swap the one-time code from the OAuth redirect for tokens.","tags":["auth"]}},"/api/v1/me":{"get":{"operationId":"MeController_me","parameters":[],"responses":{"200":{"description":""}},"summary":"Current user, their businesses, roles, plan and enabled features.","tags":["me"]},"patch":{"operationId":"MeController_update","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMeDto"}}}},"responses":{"200":{"description":""}},"tags":["me"]}},"/api/v1/me/businesses":{"post":{"operationId":"MeController_createBusiness","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBusinessDto"}}}},"responses":{"201":{"description":""}},"summary":"Used after Google sign-up (no business yet) or to open an additional shop.","tags":["me"]}},"/api/v1/business":{"get":{"operationId":"BusinessController_get","parameters":[],"responses":{"200":{"description":""}},"tags":["business"]},"patch":{"operationId":"BusinessController_update","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBusinessDto"}}}},"responses":{"200":{"description":""}},"tags":["business"]}},"/api/v1/business/stores":{"get":{"operationId":"BusinessController_stores","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["business"]},"post":{"operationId":"BusinessController_createStore","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoreDto"}}}},"responses":{"201":{"description":""}},"tags":["business"]}},"/api/v1/business/stores/{id}":{"patch":{"operationId":"BusinessController_updateStore","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoreDto"}}}},"responses":{"200":{"description":""}},"tags":["business"]}},"/api/v1/business/terminals":{"post":{"operationId":"BusinessController_registerTerminal","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TerminalDto"}}}},"responses":{"201":{"description":""}},"tags":["business"]}},"/api/v1/business/terminals/{id}":{"delete":{"operationId":"BusinessController_removeTerminal","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["business"]}},"/api/v1/business/members":{"get":{"operationId":"BusinessController_members","parameters":[],"responses":{"200":{"description":""}},"tags":["business"]},"post":{"operationId":"BusinessController_invite","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteDto"}}}},"responses":{"201":{"description":""}},"tags":["business"]}},"/api/v1/business/members/{id}":{"patch":{"operationId":"BusinessController_updateMember","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberDto"}}}},"responses":{"200":{"description":""}},"tags":["business"]}},"/api/v1/business/members/me/pin":{"post":{"operationId":"BusinessController_setPin","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PinDto"}}}},"responses":{"201":{"description":""}},"summary":"Quick-switch PIN for shared tills (cashier taps their name + PIN).","tags":["business"]}},"/api/v1/public/plans":{"get":{"operationId":"PublicController_plans","parameters":[],"responses":{"200":{"description":""}},"tags":["public"]}},"/api/v1/catalog/sync":{"get":{"operationId":"CatalogController_sync","parameters":[{"name":"since","required":false,"in":"query","schema":{"type":"string"}},{"name":"storeId","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"Offline sync pull: everything changed since `since` (ISO). Devices cache this locally.\nIncludes stock for `storeId`.","tags":["catalog"]}},"/api/v1/catalog/categories":{"get":{"operationId":"CatalogController_categories","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["catalog"]},"post":{"operationId":"CatalogController_createCategory","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryDto"}}}},"responses":{"201":{"description":""}},"tags":["catalog"]}},"/api/v1/catalog/categories/{id}":{"patch":{"operationId":"CatalogController_updateCategory","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryDto"}}}},"responses":{"200":{"description":""}},"tags":["catalog"]},"delete":{"operationId":"CatalogController_deleteCategory","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["catalog"]}},"/api/v1/catalog/products":{"get":{"operationId":"CatalogController_products","parameters":[{"name":"q","required":false,"in":"query","schema":{"type":"string"}},{"name":"categoryId","required":false,"in":"query","schema":{"type":"string"}},{"name":"storeId","required":false,"in":"query","schema":{"type":"string"}},{"name":"active","required":false,"in":"query","schema":{}},{"name":"take","required":false,"in":"query","schema":{}},{"name":"page","required":false,"in":"query","schema":{}}],"responses":{"200":{"description":""}},"tags":["catalog"]},"post":{"operationId":"CatalogController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductDto"}}}},"responses":{"201":{"description":""}},"tags":["catalog"]}},"/api/v1/catalog/products/barcode/{code}":{"get":{"operationId":"CatalogController_byBarcode","parameters":[{"name":"code","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"summary":"Lookup by barcode (main or extra barcode) — used by scanners.","tags":["catalog"]}},"/api/v1/catalog/products/{id}":{"get":{"operationId":"CatalogController_product","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["catalog"]},"patch":{"operationId":"CatalogController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["catalog"]},"delete":{"operationId":"CatalogController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["catalog"]}},"/api/v1/catalog/products/{id}/barcodes":{"post":{"operationId":"CatalogController_addBarcode","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":""}},"tags":["catalog"]}},"/api/v1/catalog/products/import":{"post":{"operationId":"CatalogController_import","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportDto"}}}},"responses":{"201":{"description":""}},"summary":"Bulk import (client parses CSV/Excel). Upserts by barcode, then SKU, then exact name.","tags":["catalog"]}},"/api/v1/catalog/export":{"get":{"operationId":"CatalogController_export","parameters":[{"name":"storeId","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["catalog"]}},"/api/v1/stock/levels":{"get":{"operationId":"StockController_levels","parameters":[{"name":"storeId","required":true,"in":"query","schema":{"type":"string"}},{"name":"low","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["stock"]}},"/api/v1/stock/adjust":{"post":{"operationId":"StockController_adjust","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdjustDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["stock"]}},"/api/v1/stock/count":{"post":{"operationId":"StockController_count","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CountDto"}}}},"responses":{"201":{"description":""}},"summary":"Stock take: send counted quantities; differences are posted as COUNT movements.","tags":["stock"]}},"/api/v1/stock/movements":{"get":{"operationId":"StockController_movements","parameters":[{"name":"storeId","required":false,"in":"query","schema":{"type":"string"}},{"name":"productId","required":false,"in":"query","schema":{"type":"string"}},{"name":"take","required":false,"in":"query","schema":{}}],"responses":{"200":{"description":""}},"tags":["stock"]}},"/api/v1/stock/expiring":{"get":{"operationId":"StockController_expiring","parameters":[{"name":"storeId","required":true,"in":"query","schema":{"type":"string"}},{"name":"days","required":false,"in":"query","schema":{}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}}},"tags":["stock"]}},"/api/v1/customers":{"get":{"operationId":"CustomersController_list","parameters":[{"name":"q","required":false,"in":"query","schema":{"type":"string"}},{"name":"owing","required":false,"in":"query","schema":{"type":"string"}},{"name":"take","required":false,"in":"query","schema":{}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["customers"]},"post":{"operationId":"CustomersController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerDto"}}}},"responses":{"201":{"description":""}},"tags":["customers"]}},"/api/v1/customers/{id}":{"get":{"operationId":"CustomersController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["customers"]},"patch":{"operationId":"CustomersController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["customers"]}},"/api/v1/customers/{id}/payments":{"post":{"operationId":"CustomersController_pay","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentDto"}}}},"responses":{"201":{"description":""}},"summary":"Customer pays off (part of) their credit balance.","tags":["customers"]}},"/api/v1/customers/{id}/adjust":{"post":{"operationId":"CustomersController_adjust","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdjustBalanceDto"}}}},"responses":{"201":{"description":""}},"tags":["customers"]}},"/api/v1/sales":{"post":{"operationId":"SalesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaleDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["sales"]},"get":{"operationId":"SalesController_list","parameters":[{"name":"storeId","required":false,"in":"query","schema":{"type":"string"}},{"name":"from","required":false,"in":"query","schema":{"type":"string"}},{"name":"to","required":false,"in":"query","schema":{"type":"string"}},{"name":"q","required":false,"in":"query","schema":{"type":"string"}},{"name":"customerId","required":false,"in":"query","schema":{"type":"string"}},{"name":"shiftId","required":false,"in":"query","schema":{"type":"string"}},{"name":"take","required":false,"in":"query","schema":{}},{"name":"page","required":false,"in":"query","schema":{}}],"responses":{"200":{"description":""}},"tags":["sales"]}},"/api/v1/sales/sync":{"post":{"operationId":"SalesController_sync","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncDto"}}}},"responses":{"201":{"description":""}},"summary":"Upload sales recorded offline. Each one is idempotent by clientId; failures are reported per sale.","tags":["sales"]}},"/api/v1/sales/{id}":{"get":{"operationId":"SalesController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["sales"]}},"/api/v1/sales/{id}/void":{"post":{"operationId":"SalesController_void","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoidDto"}}}},"responses":{"201":{"description":""}},"tags":["sales"]}},"/api/v1/sales/receipt/{token}":{"get":{"operationId":"SalesController_receipt","parameters":[{"name":"token","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"Public e-bill (SMS link). Only the random receipt token gives access.","tags":["sales"]}},"/api/v1/shifts/current":{"get":{"operationId":"ShiftsController_current","parameters":[{"name":"storeId","required":true,"in":"query","schema":{"type":"string"}},{"name":"terminalId","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"The open shift for this user on this terminal/store, if any.","tags":["shifts"]}},"/api/v1/shifts/open":{"post":{"operationId":"ShiftsController_open","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenDto"}}}},"responses":{"201":{"description":""}},"tags":["shifts"]}},"/api/v1/shifts/{id}/cash":{"post":{"operationId":"ShiftsController_cash","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CashDto"}}}},"responses":{"201":{"description":""}},"tags":["shifts"]}},"/api/v1/shifts/{id}/report":{"get":{"operationId":"ShiftsController_report","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"X report (while open) — same numbers as the Z report without closing.","tags":["shifts"]}},"/api/v1/shifts/{id}/close":{"post":{"operationId":"ShiftsController_close","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseDto"}}}},"responses":{"201":{"description":""}},"summary":"Z report: close the shift with the counted cash.","tags":["shifts"]}},"/api/v1/shifts":{"get":{"operationId":"ShiftsController_list","parameters":[{"name":"storeId","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["shifts"]}},"/api/v1/reports/dashboard":{"get":{"operationId":"ReportsController_dashboard","parameters":[{"name":"storeId","required":false,"in":"query","schema":{"type":"string"}},{"name":"from","required":false,"in":"query","schema":{"type":"string"}},{"name":"to","required":false,"in":"query","schema":{"type":"string"}},{"name":"period","required":false,"in":"query","schema":{}}],"responses":{"200":{"description":""}},"summary":"Dashboard: `period` = today | yesterday | 7d | 30d | month, or explicit from/to (ISO).","tags":["reports"]}},"/api/v1/billing":{"get":{"operationId":"BillingController_overview","parameters":[],"responses":{"200":{"description":""}},"summary":"Current plan, usage against limits, available plans, SMS packs and recent invoices.","tags":["billing"]}},"/api/v1/billing/checkout":{"post":{"operationId":"BillingController_checkout","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutDto"}}}},"responses":{"201":{"description":""}},"summary":"Returns a signed PayHere form; the client POSTs it to `action`. Plans: owners. SMS packs: owners & managers.","tags":["billing"]}},"/api/v1/billing/cancel":{"post":{"operationId":"BillingController_cancel","parameters":[],"responses":{"201":{"description":""}},"summary":"Stops auto-renewal. The plan stays active until the end of the paid period.","tags":["billing"]}},"/api/v1/billing/invoices":{"get":{"operationId":"BillingController_invoices","parameters":[{"name":"take","required":false,"in":"query","schema":{}}],"responses":{"200":{"description":""}},"tags":["billing"]}},"/api/v1/billing/invoices/{id}":{"get":{"operationId":"BillingController_invoice","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["billing"]}},"/api/v1/billing/checkout/{id}":{"get":{"operationId":"BillingController_checkoutStatus","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"summary":"Status of one checkout — the billing page polls this after PayHere redirects back.","tags":["billing"]}},"/api/v1/billing/payhere/notify":{"post":{"operationId":"BillingController_notify","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"string"}}}}},"summary":"PayHere server-to-server notification (application/x-www-form-urlencoded). Bad signatures get 200 (ignored); our own errors get 500 so PayHere retries — handling is idempotent.","tags":["billing"]}},"/api/v1/admin/overview":{"get":{"operationId":"AdminController_overview","parameters":[],"responses":{"200":{"description":""}},"tags":["admin"]}},"/api/v1/admin/businesses":{"get":{"operationId":"AdminController_businesses","parameters":[{"name":"q","required":false,"in":"query","schema":{"type":"string"}},{"name":"status","required":false,"in":"query","schema":{"type":"string"}},{"name":"page","required":false,"in":"query","schema":{}}],"responses":{"200":{"description":""}},"tags":["admin"]}},"/api/v1/admin/businesses/{id}":{"get":{"operationId":"AdminController_business","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["admin"]}},"/api/v1/admin/businesses/{id}/subscription":{"patch":{"operationId":"AdminController_updateSub","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSubDto"}}}},"responses":{"200":{"description":""}},"summary":"Manual adjustments: extend a trial, comp a plan, add SMS credits. Every change is audit-logged.","tags":["admin"]}},"/api/v1/admin/invoices":{"get":{"operationId":"AdminController_invoices","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["admin"]}},"/api/v1/admin/jobs/billing-daily":{"post":{"operationId":"AdminController_runBilling","parameters":[],"responses":{"201":{"description":""}},"summary":"Runs the daily billing job now (reminders, past-due, expiry).","tags":["admin"]}},"/api/v1/suppliers":{"get":{"operationId":"PurchasingController_suppliers","parameters":[{"name":"q","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["purchasing"]},"post":{"operationId":"PurchasingController_createSupplier","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierDto"}}}},"responses":{"201":{"description":""}},"tags":["purchasing"]}},"/api/v1/suppliers/{id}":{"get":{"operationId":"PurchasingController_supplier","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["purchasing"]},"patch":{"operationId":"PurchasingController_updateSupplier","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierDto"}}}},"responses":{"200":{"description":""}},"tags":["purchasing"]}},"/api/v1/suppliers/{id}/payments":{"post":{"operationId":"PurchasingController_paySupplier","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierPaymentDto"}}}},"responses":{"201":{"description":""}},"summary":"Pay a supplier. Cheque payments are also added to the cheque register (issued).","tags":["purchasing"]}},"/api/v1/purchases":{"get":{"operationId":"PurchasingController_purchases","parameters":[{"name":"supplierId","required":false,"in":"query","schema":{"type":"string"}},{"name":"take","required":false,"in":"query","schema":{}}],"responses":{"200":{"description":""}},"tags":["purchasing"]},"post":{"operationId":"PurchasingController_receive","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseDto"}}}},"responses":{"201":{"description":""}},"summary":"Receive goods: stock in at cost (with batch/expiry), update product cost, supplier balance for the unpaid part.","tags":["purchasing"]}},"/api/v1/purchases/{id}":{"get":{"operationId":"PurchasingController_purchase","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["purchasing"]}},"/api/v1/sales/{id}/sms":{"post":{"operationId":"EngagementController_ebill","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmsDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"summary":"SMS the e-bill link (myposlab.lk/r/…) to the customer or any number.","tags":["engagement"]}},"/api/v1/credit/customers/{id}/remind":{"post":{"operationId":"EngagementController_remind","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":""}},"summary":"SMS a friendly balance reminder in the customer's language.","tags":["engagement"]}},"/api/v1/reports/nightly-preview":{"get":{"operationId":"EngagementController_nightlyPreview","parameters":[],"responses":{"200":{"description":""}},"summary":"Preview of tonight's owner SMS.","tags":["engagement"]}},"/api/v1/business/payment-qr":{"get":{"operationId":"EngagementController_paymentQr","parameters":[],"responses":{"200":{"description":""}},"summary":"Shop QR payment details shown at the till and on e-bills.","tags":["engagement"]}},"/api/v1/cheques":{"get":{"operationId":"EngagementController_cheques","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string"}},{"name":"direction","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["engagement"]},"post":{"operationId":"EngagementController_addCheque","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChequeDto"}}}},"responses":{"201":{"description":""}},"tags":["engagement"]}},"/api/v1/cheques/{id}":{"patch":{"operationId":"EngagementController_chequeStatus","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChequeStatusDto"}}}},"responses":{"200":{"description":""}},"summary":"Move a cheque along: deposited → cleared, or bounced.\nA bounced customer cheque goes back onto their credit balance; a bounced supplier cheque back onto what we owe.","tags":["engagement"]}},"/api/v1/admin/jobs/engagement-hourly":{"post":{"operationId":"EngagementController_runHourly","parameters":[],"responses":{"201":{"description":""}},"summary":"Runs the hourly engagement job now (super admin; for testing).","tags":["engagement"]}},"/api/v1/scanner/sessions":{"post":{"operationId":"ScannerController_open","parameters":[],"responses":{"201":{"description":""}},"tags":["scanner"]}},"/api/v1/scanner/sessions/{code}/stream":{"get":{"operationId":"ScannerController_stream","parameters":[{"name":"code","required":true,"in":"path","schema":{"type":"string"}},{"name":"token","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"SSE stream for the till. EventSource can't send headers, so the session token goes in the query.","tags":["scanner"]}},"/api/v1/scanner/sessions/{code}/scan":{"post":{"operationId":"ScannerController_scan","parameters":[{"name":"code","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScanDto"}}}},"responses":{"201":{"description":""}},"summary":"Called by the phone page. The 8-character code is the only credential, so it is rate-limited.","tags":["scanner"]}},"/api/v1/scanner/sessions/{code}":{"get":{"operationId":"ScannerController_status","parameters":[{"name":"code","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["scanner"]}},"/api/v1/reorder/suggestions":{"get":{"operationId":"ReorderController_suggestions","parameters":[{"name":"storeId","required":true,"in":"query","schema":{"type":"string"}},{"name":"coverDays","required":false,"in":"query","schema":{"type":"string"}},{"name":"windowDays","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"Suggested purchase quantities grouped by supplier.","tags":["reorder"]}},"/api/v1/reorder/expiring":{"get":{"operationId":"ReorderController_expiring","parameters":[{"name":"storeId","required":true,"in":"query","schema":{"type":"string"}},{"name":"days","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"Batches expiring soon, flagged when they won't sell out in time.","tags":["reorder"]}},"/api/v1/promotions/festivals":{"get":{"operationId":"PromotionsController_festivals","parameters":[],"responses":{"200":{"description":""}},"tags":["promotions"]}},"/api/v1/promotions":{"get":{"operationId":"PromotionsController_list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}}},"tags":["promotions"]},"post":{"operationId":"PromotionsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromotionDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["promotions"]}},"/api/v1/promotions/active":{"get":{"operationId":"PromotionsController_active","parameters":[],"responses":{"200":{"description":""}},"summary":"Promotions the till applies. Returns running and upcoming (next 7 days) offers so an offline till\nstill switches them on at the right time. Empty (not 402) when the plan lacks promotions.","tags":["promotions"]}},"/api/v1/promotions/{id}":{"patch":{"operationId":"PromotionsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["promotions"]}},"/api/v1/campaigns":{"get":{"operationId":"PromotionsController_campaignList","parameters":[],"responses":{"200":{"description":""}},"tags":["promotions"]},"post":{"operationId":"PromotionsController_send","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDto"}}}},"responses":{"201":{"description":""}},"tags":["promotions"]}},"/api/v1/campaigns/preview":{"post":{"operationId":"PromotionsController_preview","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDto"}}}},"responses":{"201":{"description":""}},"tags":["promotions"]}},"/api/v1/campaigns/{id}":{"get":{"operationId":"PromotionsController_campaign","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["promotions"]}},"/api/v1/assistant/ask":{"post":{"operationId":"AssistantController_ask","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AskDto"}}}},"responses":{"201":{"description":""}},"tags":["assistant"]}},"/mcp":{"post":{"operationId":"McpController_handle","parameters":[],"responses":{"201":{"description":""}},"tags":["mcp"]},"get":{"operationId":"McpController_get","parameters":[],"responses":{"200":{"description":""}},"summary":"Stateless server: no SSE stream and no sessions to delete.","tags":["mcp"]},"delete":{"operationId":"McpController_del","parameters":[],"responses":{"200":{"description":""}},"tags":["mcp"]}},"/api/v1/api-keys":{"get":{"operationId":"ApiKeysController_list","parameters":[],"responses":{"200":{"description":""}},"tags":["api-keys"]},"post":{"operationId":"ApiKeysController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyDto"}}}},"responses":{"201":{"description":""}},"summary":"Returns the full key once. Only its SHA-256 hash is stored.","tags":["api-keys"]}},"/api/v1/api-keys/{id}":{"delete":{"operationId":"ApiKeysController_revoke","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["api-keys"]}},"/api/v1/transfers":{"get":{"operationId":"TransfersController_list","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["transfers"]},"post":{"operationId":"TransfersController_send","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["transfers"]}},"/api/v1/transfers/{id}/receive":{"post":{"operationId":"TransfersController_receive","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiveDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["transfers"]}},"/api/v1/transfers/{id}/cancel":{"post":{"operationId":"TransfersController_cancel","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":""}},"tags":["transfers"]}},"/api/v1/serials":{"get":{"operationId":"SerialsController_inStock","parameters":[{"name":"productId","required":true,"in":"query","schema":{"type":"string"}},{"name":"storeId","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["serials"]}},"/api/v1/serials/{serial}":{"get":{"operationId":"SerialsController_lookup","parameters":[{"name":"serial","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["serials"]}},"/api/v1/reports/advanced/categories":{"get":{"operationId":"AdvancedReportsController_categories","parameters":[{"name":"from","required":false,"in":"query","schema":{"type":"string"}},{"name":"to","required":false,"in":"query","schema":{"type":"string"}},{"name":"storeId","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["reports"]}},"/api/v1/reports/advanced/branches":{"get":{"operationId":"AdvancedReportsController_branches","parameters":[{"name":"from","required":false,"in":"query","schema":{"type":"string"}},{"name":"to","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"tags":["reports"]}},"/api/v1/reports/advanced/months":{"get":{"operationId":"AdvancedReportsController_months","parameters":[{"name":"storeId","required":false,"in":"query","schema":{"type":"string"}},{"name":"months","required":false,"in":"query","schema":{}}],"responses":{"200":{"description":""}},"summary":"Month by month for the last `months` months (max 24).","tags":["reports"]}},"/api/v1/reports/advanced/vat":{"get":{"operationId":"AdvancedReportsController_vat","parameters":[{"name":"from","required":false,"in":"query","schema":{"type":"string"}},{"name":"to","required":false,"in":"query","schema":{"type":"string"}},{"name":"storeId","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"VAT summary for the return: taxable supplies and output VAT by rate, plus zero-rated/exempt sales.\nPrices include VAT, so the taxable value is the line total less its VAT.","tags":["reports"]}},"/api/v1/reports/advanced/stock-value":{"get":{"operationId":"AdvancedReportsController_stockValue","parameters":[{"name":"storeId","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"Stock on hand valued at cost and at selling price, by category; plus batches by expiry.","tags":["reports"]}}},"info":{"title":"myposlab API","description":"REST API for myposlab — POS for Sri Lankan shops. Authenticate with a Bearer access token (from /auth/login) or a business API key (mpl_…). Tenant-scoped endpoints need the X-Business-Id header (implied for API keys).","version":"1.0","contact":{}},"tags":[],"servers":[{"url":"https://posbackend.ideus.lk"}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"RegisterDto":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":80},"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":8,"maxLength":100},"businessName":{"type":"string","minLength":2,"maxLength":80},"businessType":{"type":"string","enum":["GROCERY","SUPERMARKET","PHARMACY","HARDWARE","CLOTHING","BOOKSHOP","BAKERY","RESTAURANT","CAFE","ELECTRONICS","MOBILE_SHOP","COSMETICS","SALON","WHOLESALE","OTHER"]},"phone":{"type":"string","pattern":"^[+0-9 ()-]{9,16}$"},"locale":{"type":"string","enum":["en","si","ta"]}},"required":["name","email","password","businessName"]},"VerifyEmailDto":{"type":"object","properties":{"email":{"type":"string","format":"email"},"code":{"type":"string","minLength":6,"maxLength":6}},"required":["email","code"]},"EmailDto":{"type":"object","properties":{"email":{"type":"string","format":"email"}},"required":["email"]},"LoginDto":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":1}},"required":["email","password"]},"RefreshDto":{"type":"object","properties":{"refreshToken":{"type":"string"}},"required":["refreshToken"]},"ResetPasswordDto":{"type":"object","properties":{"email":{"type":"string","format":"email"},"code":{"type":"string","minLength":6,"maxLength":6},"password":{"type":"string","minLength":8,"maxLength":100}},"required":["email","code","password"]},"ChangePasswordDto":{"type":"object","properties":{"currentPassword":{"type":"string"},"newPassword":{"type":"string","minLength":8,"maxLength":100}},"required":["newPassword"]},"ExchangeDto":{"type":"object","properties":{"code":{"type":"string"}},"required":["code"]},"UpdateMeDto":{"type":"object","properties":{}},"CreateBusinessDto":{"type":"object","properties":{}},"UpdateBusinessDto":{"type":"object","properties":{}},"StoreDto":{"type":"object","properties":{}},"TerminalDto":{"type":"object","properties":{}},"InviteDto":{"type":"object","properties":{}},"MemberDto":{"type":"object","properties":{}},"PinDto":{"type":"object","properties":{}},"CategoryDto":{"type":"object","properties":{}},"ProductDto":{"type":"object","properties":{}},"ImportDto":{"type":"object","properties":{}},"AdjustDto":{"type":"object","properties":{}},"CountDto":{"type":"object","properties":{}},"CustomerDto":{"type":"object","properties":{}},"PaymentDto":{"type":"object","properties":{}},"AdjustBalanceDto":{"type":"object","properties":{}},"SaleItemDto":{"type":"object","properties":{"productId":{"type":"string"},"name":{"type":"string","maxLength":160},"barcode":{"type":"string"},"qty":{"type":"number","minimum":0.001},"unitPrice":{"type":"number","minimum":0},"discount":{"type":"number","minimum":0},"taxRate":{"type":"number","minimum":0},"serial":{"type":"string"}},"required":["name","qty","unitPrice"]},"SaleDto":{"type":"object","properties":{"clientId":{"type":"string","description":"UUID generated on the device","maxLength":64},"storeId":{"type":"string"},"terminalId":{"type":"string"},"shiftId":{"type":"string"},"type":{"type":"string","enum":["SALE","RETURN","QUOTE"]},"status":{"type":"string","enum":["COMPLETED","HELD"]},"originalSaleId":{"type":"string"},"customerId":{"type":"string"},"items":{"maxItems":500,"type":"array","items":{"$ref":"#/components/schemas/SaleItemDto"}},"discount":{"type":"number","minimum":0},"payments":{"type":"array","items":{"$ref":"#/components/schemas/PaymentDto"}},"note":{"type":"string","maxLength":500},"soldAt":{"type":"string","description":"When the sale happened on the device (offline sales sync later)"}},"required":["clientId","storeId","items"]},"SyncDto":{"type":"object","properties":{"sales":{"maxItems":200,"type":"array","items":{"$ref":"#/components/schemas/SaleDto"}}},"required":["sales"]},"VoidDto":{"type":"object","properties":{"reason":{"type":"string","maxLength":200}},"required":["reason"]},"OpenDto":{"type":"object","properties":{}},"CashDto":{"type":"object","properties":{}},"CloseDto":{"type":"object","properties":{}},"CheckoutDto":{"type":"object","properties":{}},"UpdateSubDto":{"type":"object","properties":{}},"SupplierDto":{"type":"object","properties":{}},"SupplierPaymentDto":{"type":"object","properties":{}},"PurchaseDto":{"type":"object","properties":{}},"SmsDto":{"type":"object","properties":{}},"ChequeDto":{"type":"object","properties":{}},"ChequeStatusDto":{"type":"object","properties":{}},"ScanDto":{"type":"object","properties":{}},"PromotionDto":{"type":"object","properties":{}},"CampaignDto":{"type":"object","properties":{}},"AskDto":{"type":"object","properties":{}},"ApiKeyDto":{"type":"object","properties":{}},"TransferDto":{"type":"object","properties":{}},"ReceiveDto":{"type":"object","properties":{}}}}}