{"openapi":"3.1.0","info":{"title":"NxFusion ERP API","version":"0.1.0","description":"Multi-tenant ERP API. Every request is scoped to a tenant resolved from the subdomain. This spec is generated from the same Zod schemas used to validate requests, so it never drifts."},"servers":[{"url":"/","description":"Current tenant host"}],"tags":[{"name":"Platform","description":"Health, system"},{"name":"Auth","description":"Authentication & session"},{"name":"Tenancy","description":"Tenant signup, provisioning, users"},{"name":"Config","description":"Per-tenant config, branding & feature flags"},{"name":"AI","description":"LLM gateway, RAG, usage metering & human-in-the-loop"},{"name":"Billing","description":"Plans, subscriptions, invoices & payments"},{"name":"Finance","description":"Chart of accounts, journals, trial balance, AR/AP, reports"},{"name":"Sales","description":"Products, quotations, sales orders, delivery orders"},{"name":"Purchasing","description":"Requisitions, purchase orders, goods receipt, 3-way match"},{"name":"Inventory","description":"Locations, stock movements, valuation, stock take, barcode"},{"name":"Retail","description":"POS, outlets, loyalty members"},{"name":"Compliance","description":"Malaysia SST + MyInvois e-invoice"},{"name":"Approvals","description":"Approval requests & decisions"}],"components":{"schemas":{"HealthResponse":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"service":{"type":"string","example":"web"},"db":{"type":"string","enum":["up","down"],"example":"up"},"time":{"type":"string","example":"2026-06-24T00:00:00.000Z"}},"required":["status","service","db","time"]},"SessionUser":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"},"roles":{"type":"array","items":{"type":"string"}},"permissions":{"type":"array","items":{"type":"string"},"example":["user.read","user.manage"]}},"required":["id","email","name","roles","permissions"]},"LoginResponse":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/SessionUser"}},"required":["user"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","example":"VALIDATION_ERROR"},"message":{"type":"string","example":"Request validation failed"},"details":{"type":"array","items":{}}},"required":["code","message"]}},"required":["error"]},"LoginRequest":{"type":"object","properties":{"email":{"type":"string","format":"email","example":"owner@acme.com"},"password":{"type":"string","minLength":1}},"required":["email","password"]},"Branding":{"type":"object","properties":{"displayName":{"type":"string"},"primaryColor":{"type":"string","example":"#2563eb"},"logoUrl":{"type":"string","format":"uri"}}},"TenantConfigResponse":{"type":"object","properties":{"tenantId":{"type":"string"},"slug":{"type":"string"},"plan":{"type":"string","enum":["starter","growth","enterprise"]},"region":{"type":"string","enum":["MY","SG"]},"branding":{"$ref":"#/components/schemas/Branding"},"features":{"type":"object","additionalProperties":{"type":"boolean"},"example":{"ai.document":true,"compliance.sg":false}}},"required":["tenantId","slug","plan","region","branding","features"]},"UpdateFlagsRequest":{"type":"object","properties":{"flags":{"type":"object","additionalProperties":{"type":"boolean"},"example":{"compliance.sg":true}}},"required":["flags"]},"UpdateBrandingRequest":{"type":"object","properties":{"displayName":{"type":"string"},"primaryColor":{"type":"string","example":"#2563eb"},"logoUrl":{"type":"string","format":"uri"}}},"IngestResponse":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]},"IngestRequest":{"type":"object","properties":{"source":{"type":"string","minLength":1,"example":"note"},"text":{"type":"string","minLength":1,"example":"Q1 sales in the northern region were RM 1.2M."}},"required":["source","text"]},"AskResponse":{"type":"object","properties":{"suggestionId":{"type":"string"},"answer":{"type":"string"},"confidence":{"type":"number"},"grounded":{"type":"boolean"},"requiresReview":{"type":"boolean"},"sources":{"type":"array","items":{"type":"string"}},"model":{"type":"string"},"status":{"type":"string"}},"required":["suggestionId","answer","confidence","grounded","requiresReview","sources","model","status"]},"AskRequest":{"type":"object","properties":{"question":{"type":"string","minLength":1,"example":"What were Q1 sales in the north?"}},"required":["question"]},"ExtractionResponse":{"type":"object","properties":{"id":{"type":"string"},"supplierName":{"type":"string"},"totalCents":{"type":"number"},"confidence":{"type":"number"},"status":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string"},"amountCents":{"type":"number"}},"required":["description","amountCents"]}},"apBillId":{"type":"string"}},"required":["id","supplierName","totalCents","confidence","status","lines"]},"ExtractRequest":{"type":"object","properties":{"kind":{"type":"string"},"text":{"type":"string","minLength":1,"example":"ACME Supplies\nWidgets x10  500.00\nTotal: 500.00"}},"required":["text"]},"ExtractionsResponse":{"type":"object","properties":{"extractions":{"type":"array","items":{"$ref":"#/components/schemas/ExtractionResponse"}}},"required":["extractions"]},"ApproveExtractionRequest":{"type":"object","properties":{"supplierId":{"type":"string","minLength":1},"accountCode":{"type":"string"}},"required":["supplierId"]},"UsageResponse":{"type":"object","properties":{"calls":{"type":"number"},"inputTokens":{"type":"number"},"outputTokens":{"type":"number"},"byTier":{"type":"object","additionalProperties":{"type":"number"}}},"required":["calls","inputTokens","outputTokens","byTier"]},"SuggestionResponse":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"answer":{"type":"string"},"editedAnswer":{"type":"string"},"confidence":{"type":"number"},"status":{"type":"string"}},"required":["id","kind","answer","confidence","status"]},"DecisionRequest":{"type":"object","properties":{"decision":{"type":"string","enum":["approve","reject","edit"]},"editedAnswer":{"type":"string"}},"required":["decision"]},"PlanInfo":{"type":"object","properties":{"id":{"type":"string","enum":["starter","growth","enterprise"]},"name":{"type":"string"},"baseCents":{"type":"number"},"perSeatCents":{"type":"number"},"includedSeats":{"type":"number"},"maxSeats":{"type":["number","null"]},"includedAiTokens":{"type":"number"},"aiOverageCentsPerKTokens":{"type":"number"},"trialDays":{"type":"number"}},"required":["id","name","baseCents","perSeatCents","includedSeats","maxSeats","includedAiTokens","aiOverageCentsPerKTokens","trialDays"]},"PlansResponse":{"type":"object","properties":{"plans":{"type":"array","items":{"$ref":"#/components/schemas/PlanInfo"}}},"required":["plans"]},"SubscriptionResponse":{"type":"object","properties":{"plan":{"type":"string","enum":["starter","growth","enterprise"]},"status":{"type":"string","enum":["trialing","active","past_due","canceled"]},"seats":{"type":"number"},"trialEndsAt":{"type":["string","null"]},"currentPeriodStart":{"type":"string"},"currentPeriodEnd":{"type":"string"}},"required":["plan","status","seats","trialEndsAt","currentPeriodStart","currentPeriodEnd"]},"SubscribeRequest":{"type":"object","properties":{"plan":{"type":"string","enum":["starter","growth","enterprise"]},"seats":{"type":"integer","minimum":1,"default":1}},"required":["plan"]},"ChangePlanRequest":{"type":"object","properties":{"plan":{"type":"string","enum":["starter","growth","enterprise"]}},"required":["plan"]},"InvoiceResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"currency":{"type":"string"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string"},"amountCents":{"type":"number"}},"required":["description","amountCents"]}},"totalCents":{"type":"number"},"status":{"type":"string","enum":["open","paid","void"]}},"required":["id","number","currency","periodStart","periodEnd","lineItems","totalCents","status"]},"InvoicesResponse":{"type":"object","properties":{"invoices":{"type":"array","items":{"$ref":"#/components/schemas/InvoiceResponse"}}},"required":["invoices"]},"AiUsageResponse":{"type":"object","properties":{"plan":{"type":"string"},"includedTokens":{"type":"number"},"usedTokens":{"type":"number"},"overageTokens":{"type":"number"},"overageCents":{"type":"number"},"overageRateCentsPerKTokens":{"type":"number"},"periodEnd":{"type":"string"}},"required":["plan","includedTokens","usedTokens","overageTokens","overageCents","overageRateCentsPerKTokens","periodEnd"]},"BillingSummaryResponse":{"type":"object","properties":{"plan":{"type":"string"},"status":{"type":"string"},"seats":{"type":"number"},"mrrCents":{"type":"number"},"arrCents":{"type":"number"},"billedCents":{"type":"number"},"paidCents":{"type":"number"},"outstandingCents":{"type":"number"},"openInvoices":{"type":"number"},"overdueInvoices":{"type":"number"}},"required":["plan","status","seats","mrrCents","arrCents","billedCents","paidCents","outstandingCents","openInvoices","overdueInvoices"]},"DunningResultResponse":{"type":"object","properties":{"dunned":{"type":"number"},"suspended":{"type":"boolean"}},"required":["dunned","suspended"]},"OperatorRevenueResponse":{"type":"object","properties":{"tenants":{"type":"number"},"activeTenants":{"type":"number"},"activeSubscriptions":{"type":"number"},"totalMrrCents":{"type":"number"},"totalArrCents":{"type":"number"},"byPlan":{"type":"array","items":{"type":"object","properties":{"plan":{"type":"string"},"subscriptions":{"type":"number"},"mrrCents":{"type":"number"}},"required":["plan","subscriptions","mrrCents"]}},"billedCents":{"type":"number"},"paidCents":{"type":"number"},"outstandingCents":{"type":"number"},"overdueCents":{"type":"number"}},"required":["tenants","activeTenants","activeSubscriptions","totalMrrCents","totalArrCents","byPlan","billedCents","paidCents","outstandingCents","overdueCents"]},"AccountResponse":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["asset","liability","equity","income","expense"]},"normalBalance":{"type":"string","enum":["debit","credit"]},"isActive":{"type":"boolean"}},"required":["id","code","name","type","normalBalance","isActive"]},"AccountsResponse":{"type":"object","properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/AccountResponse"}}},"required":["accounts"]},"CreateAccountRequest":{"type":"object","properties":{"code":{"type":"string","minLength":1,"example":"4200"},"name":{"type":"string","minLength":1,"example":"Consulting Revenue"},"type":{"type":"string","enum":["asset","liability","equity","income","expense"]}},"required":["code","name","type"]},"JournalResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"date":{"type":"string"},"memo":{"type":"string"},"status":{"type":"string"},"totalCents":{"type":"number"},"lines":{"type":"array","items":{"type":"object","properties":{"accountCode":{"type":"string","minLength":1},"debitCents":{"type":"integer","minimum":0,"default":0},"creditCents":{"type":"integer","minimum":0,"default":0},"description":{"type":"string"}},"required":["accountCode"]}}},"required":["id","number","date","status","totalCents","lines"]},"JournalsResponse":{"type":"object","properties":{"journals":{"type":"array","items":{"$ref":"#/components/schemas/JournalResponse"}}},"required":["journals"]},"PostJournalRequest":{"type":"object","properties":{"date":{"type":"string","format":"date-time"},"memo":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"accountCode":{"type":"string","minLength":1},"debitCents":{"type":"integer","minimum":0,"default":0},"creditCents":{"type":"integer","minimum":0,"default":0},"description":{"type":"string"}},"required":["accountCode"]},"minItems":2},"entityId":{"type":"string"}},"required":["lines"]},"TrialBalanceResponse":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object","properties":{"accountCode":{"type":"string"},"debitCents":{"type":"number"},"creditCents":{"type":"number"},"balanceCents":{"type":"number"}},"required":["accountCode","debitCents","creditCents","balanceCents"]}},"totalDebits":{"type":"number"},"totalCredits":{"type":"number"},"balanced":{"type":"boolean"}},"required":["rows","totalDebits","totalCredits","balanced"]},"RecurringInvoiceResponse":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"customerName":{"type":"string"},"memo":{"type":"string"},"interval":{"type":"string","enum":["monthly","quarterly","yearly"]},"nextRunOn":{"type":"string"},"active":{"type":"boolean"},"occurrences":{"type":"integer"},"lastRunOn":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string"},"accountCode":{"type":"string"},"amountCents":{"type":"integer"},"taxCode":{"type":"string"}},"required":["description","accountCode","amountCents"]}}},"required":["id","customerId","customerName","interval","nextRunOn","active","occurrences","lines"]},"RecurringInvoicesResponse":{"type":"object","properties":{"recurring":{"type":"array","items":{"$ref":"#/components/schemas/RecurringInvoiceResponse"}}},"required":["recurring"]},"CreateRecurringRequest":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"accountCode":{"type":"string"},"amountCents":{"type":"integer","exclusiveMinimum":0},"taxCode":{"type":"string"}},"required":["description","amountCents"]},"minItems":1},"interval":{"type":"string","enum":["monthly","quarterly","yearly"]},"startOn":{"type":"string"},"memo":{"type":"string"}},"required":["customerId","lines"]},"UpdateRecurringRequest":{"type":"object","properties":{"active":{"type":"boolean"}},"required":["active"]},"ArInvoiceResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"customerName":{"type":"string"},"totalCents":{"type":"number"},"currency":{"type":"string"},"fxRate":{"type":"number"},"baseTotalCents":{"type":"number"},"amountPaidCents":{"type":"number"},"status":{"type":"string"},"journalEntryId":{"type":"string"}},"required":["id","number","customerName","totalCents","amountPaidCents","status"]},"RunDueResponse":{"type":"object","properties":{"generated":{"type":"integer"},"numbers":{"type":"array","items":{"type":"string"}}},"required":["generated","numbers"]},"AnomaliesResponse":{"type":"object","properties":{"anomalies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"totalCents":{"type":"integer"},"score":{"type":"integer"},"severity":{"type":"string","enum":["low","medium","high"]},"reasons":{"type":"array","items":{"type":"string"}}},"required":["id","number","totalCents","score","severity","reasons"]}}},"required":["anomalies"]},"ExchangeRateResponse":{"type":"object","properties":{"currency":{"type":"string"},"rate":{"type":"number"}},"required":["currency","rate"]},"ExchangeRatesResponse":{"type":"object","properties":{"rates":{"type":"array","items":{"$ref":"#/components/schemas/ExchangeRateResponse"}}},"required":["rates"]},"SetExchangeRateRequest":{"type":"object","properties":{"currency":{"type":"string","minLength":3,"maxLength":3},"rate":{"type":"number","exclusiveMinimum":0}},"required":["currency","rate"]},"EntityResponse":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"baseCurrency":{"type":"string"},"region":{"type":"string"},"isPrimary":{"type":"boolean"},"isElimination":{"type":"boolean"},"isActive":{"type":"boolean"}},"required":["id","code","name","baseCurrency","region","isPrimary","isElimination","isActive"]},"EntitiesResponse":{"type":"object","properties":{"entities":{"type":"array","items":{"$ref":"#/components/schemas/EntityResponse"}}},"required":["entities"]},"CreateEntityRequest":{"type":"object","properties":{"code":{"type":"string","minLength":1,"example":"SG01"},"name":{"type":"string","minLength":1,"example":"Acme Singapore Pte Ltd"},"baseCurrency":{"type":"string"},"region":{"type":"string","enum":["MY","SG"]},"isElimination":{"type":"boolean"}},"required":["code","name"]},"ConsolidationResponse":{"type":"object","properties":{"entities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"isElimination":{"type":"boolean"}},"required":["id","code","name","isElimination"]}},"rows":{"type":"array","items":{"type":"object","properties":{"accountCode":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"perEntity":{"type":"object","additionalProperties":{"type":"number"}},"totalCents":{"type":"number"}},"required":["accountCode","name","type","perEntity","totalCents"]}},"totalsByEntity":{"type":"object","additionalProperties":{"type":"number"}}},"required":["entities","rows","totalsByEntity"]},"InterCoEntityBalance":{"type":"object","properties":{"entityId":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"isElimination":{"type":"boolean"},"receivableCents":{"type":"number"},"payableCents":{"type":"number"}},"required":["entityId","code","name","isElimination","receivableCents","payableCents"]},"InterCoMatchResponse":{"type":"object","properties":{"byEntity":{"type":"array","items":{"$ref":"#/components/schemas/InterCoEntityBalance"}},"realReceivableCents":{"type":"number"},"realPayableCents":{"type":"number"},"eliminatedReceivableCents":{"type":"number"},"eliminatedPayableCents":{"type":"number"},"residualReceivableCents":{"type":"number"},"residualPayableCents":{"type":"number"},"eliminableCents":{"type":"number"},"unmatchedCents":{"type":"number"}},"required":["byEntity","realReceivableCents","realPayableCents","eliminatedReceivableCents","eliminatedPayableCents","residualReceivableCents","residualPayableCents","eliminableCents","unmatchedCents"]},"InterCoEliminateResponse":{"type":"object","properties":{"eliminated":{"type":"boolean"},"journalEntryId":{"type":"string"},"eliminableCents":{"type":"number"}},"required":["eliminated","eliminableCents"]},"IcTransactionPair":{"type":"object","properties":{"receivableJournalId":{"type":"string"},"receivableNumber":{"type":"string"},"payableJournalId":{"type":"string"},"payableNumber":{"type":"string"},"fromEntityId":{"type":"string"},"toEntityId":{"type":"string"},"amountCents":{"type":"number"}},"required":["receivableJournalId","receivableNumber","payableJournalId","payableNumber","fromEntityId","toEntityId","amountCents"]},"IcTransactionPairsResponse":{"type":"object","properties":{"pairs":{"type":"array","items":{"$ref":"#/components/schemas/IcTransactionPair"}}},"required":["pairs"]},"IcMatchResultResponse":{"type":"object","properties":{"matchedPairs":{"type":"number"},"eliminatedCents":{"type":"number"},"matchIds":{"type":"array","items":{"type":"string"}}},"required":["matchedPairs","eliminatedCents","matchIds"]},"PostInterCoTxnRequest":{"type":"object","properties":{"fromEntityId":{"type":"string","minLength":1},"toEntityId":{"type":"string","minLength":1},"amountCents":{"type":"integer","exclusiveMinimum":0},"incomeCode":{"type":"string"},"expenseCode":{"type":"string"},"memo":{"type":"string"}},"required":["fromEntityId","toEntityId","amountCents"]},"RevaluationLine":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"customerName":{"type":"string"},"currency":{"type":"string"},"bookedRate":{"type":"number"},"currentRate":{"type":"number"},"outstandingForeignCents":{"type":"number"},"outstandingBaseCents":{"type":"number"},"revaluedBaseCents":{"type":"number"},"gainLossCents":{"type":"number"},"deltaCents":{"type":"number"}},"required":["id","number","customerName","currency","bookedRate","currentRate","outstandingForeignCents","outstandingBaseCents","revaluedBaseCents","gainLossCents","deltaCents"]},"RevaluationPreviewResponse":{"type":"object","properties":{"asOf":{"type":"string"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/RevaluationLine"}},"netDeltaCents":{"type":"number"}},"required":["asOf","lines","netDeltaCents"]},"RevaluationResultResponse":{"type":"object","properties":{"posted":{"type":"boolean"},"netDeltaCents":{"type":"number"},"revaluedCount":{"type":"number"},"journalEntryId":{"type":"string"},"runId":{"type":"string"}},"required":["posted","netDeltaCents","revaluedCount"]},"RevaluationRunResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"asOf":{"type":"string"},"periodKey":{"type":"string"},"netDeltaCents":{"type":"number"},"reversed":{"type":"boolean"},"reversedAt":{"type":"string"}},"required":["id","number","asOf","netDeltaCents","reversed"]},"RevaluationRunsResponse":{"type":"object","properties":{"runs":{"type":"array","items":{"$ref":"#/components/schemas/RevaluationRunResponse"}}},"required":["runs"]},"RevaluationReversalResponse":{"type":"object","properties":{"reversed":{"type":"boolean"},"netDeltaCents":{"type":"number"},"reversalJournalId":{"type":"string"}},"required":["reversed","netDeltaCents"]},"SstReportResponse":{"type":"object","properties":{"currency":{"type":"string"},"taxableSalesCents":{"type":"number"},"sstCollectedCents":{"type":"number"},"invoices":{"type":"number"}},"required":["currency","taxableSalesCents","sstCollectedCents","invoices"]},"GstF5Response":{"type":"object","properties":{"currency":{"type":"string"},"box1StandardRatedSuppliesCents":{"type":"number"},"box6OutputTaxCents":{"type":"number"},"box5TaxablePurchasesCents":{"type":"number"},"box7InputTaxCents":{"type":"number"},"box8NetGstCents":{"type":"number"},"invoices":{"type":"number"},"bills":{"type":"number"}},"required":["currency","box1StandardRatedSuppliesCents","box6OutputTaxCents","box5TaxablePurchasesCents","box7InputTaxCents","box8NetGstCents","invoices","bills"]},"Ir8aResponse":{"type":"object","properties":{"year":{"type":"string"},"rows":{"type":"array","items":{"type":"object","properties":{"employeeId":{"type":"string"},"employeeNo":{"type":"string"},"employeeName":{"type":"string"},"grossWagesCents":{"type":"integer"},"allowancesCents":{"type":"integer"},"employeeCpfCents":{"type":"integer"},"netPayCents":{"type":"integer"},"grossRemunerationCents":{"type":"integer"}},"required":["employeeId","employeeNo","employeeName","grossWagesCents","allowancesCents","employeeCpfCents","netPayCents","grossRemunerationCents"]}},"totalGrossCents":{"type":"integer"},"totalCpfCents":{"type":"integer"}},"required":["year","rows","totalGrossCents","totalCpfCents"]},"TaxSettingsRequest":{"type":"object","properties":{"tin":{"type":"string"},"sstRegNo":{"type":"string"},"defaultSstCode":{"type":"string"}}},"EInvoiceResponse":{"type":"object","properties":{"id":{"type":"string"},"arInvoiceId":{"type":"string"},"invoiceNumber":{"type":"string"},"status":{"type":"string"},"uuid":{"type":"string"},"qrText":{"type":"string"},"validationIssues":{"type":"array","items":{"type":"string"}}},"required":["id","arInvoiceId","invoiceNumber","status","validationIssues"]},"EInvoicesResponse":{"type":"object","properties":{"einvoices":{"type":"array","items":{"$ref":"#/components/schemas/EInvoiceResponse"}}},"required":["einvoices"]},"ApprovalResponse":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"title":{"type":"string"},"amountCents":{"type":"number"},"status":{"type":"string"},"note":{"type":"string"},"requestedBy":{"type":"string"},"decidedBy":{"type":"string"}},"required":["id","type","title","amountCents","status"]},"ApprovalsResponse":{"type":"object","properties":{"approvals":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalResponse"}}},"required":["approvals"]},"CreateApprovalRequest":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string","minLength":1},"entityType":{"type":"string"},"entityId":{"type":"string"},"amountCents":{"type":"integer","minimum":0},"note":{"type":"string"}},"required":["title"]},"DecideApprovalRequest":{"type":"object","properties":{"decision":{"type":"string","enum":["approve","reject"]},"note":{"type":"string"}},"required":["decision"]},"BankTxnsResponse":{"type":"object","properties":{"transactions":{"type":"array","items":{"type":"object","properties":{"entryId":{"type":"string"},"number":{"type":"string"},"date":{"type":"string"},"memo":{"type":"string"},"amountCents":{"type":"number"},"reconciled":{"type":"boolean"}},"required":["entryId","number","date","amountCents","reconciled"]}}},"required":["transactions"]},"StatementLinesResponse":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"date":{"type":"string"},"description":{"type":"string"},"amountCents":{"type":"number"},"reconciled":{"type":"boolean"},"matchedEntryId":{"type":"string"}},"required":["id","date","amountCents","reconciled"]}}},"required":["lines"]},"ImportStatementRequest":{"type":"object","properties":{"bankCode":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date-time"},"description":{"type":"string"},"amountCents":{"type":"integer"}},"required":["amountCents"]},"minItems":1}},"required":["lines"]},"MatchRequest":{"type":"object","properties":{"statementLineId":{"type":"string"},"journalEntryId":{"type":"string"}},"required":["statementLineId","journalEntryId"]},"ReconSummaryResponse":{"type":"object","properties":{"bankCode":{"type":"string"},"currency":{"type":"string"},"bookBalanceCents":{"type":"number"},"clearedBalanceCents":{"type":"number"},"statementBalanceCents":{"type":["number","null"]},"differenceCents":{"type":["number","null"]},"reconciled":{"type":"boolean"},"unreconciledLedger":{"type":"number"},"unreconciledStatement":{"type":"number"},"statementLines":{"type":"number"},"matchedLines":{"type":"number"},"matchRatePct":{"type":"number"}},"required":["bankCode","currency","bookBalanceCents","clearedBalanceCents","statementBalanceCents","differenceCents","reconciled","unreconciledLedger","unreconciledStatement"]},"MatchSuggestionsResponse":{"type":"object","properties":{"suggestions":{"type":"array","items":{"type":"object","properties":{"statementLineId":{"type":"string"},"date":{"type":"string"},"description":{"type":"string"},"amountCents":{"type":"number"},"suggestion":{"type":["object","null"],"properties":{"entryId":{"type":"string"},"number":{"type":"string"},"date":{"type":"string"},"confidence":{"type":"number"},"reason":{"type":"string"}},"required":["entryId","number","date","confidence","reason"]}},"required":["statementLineId","date","amountCents","suggestion"]}}},"required":["suggestions"]},"ProfitLossResponse":{"type":"object","properties":{"currency":{"type":"string"},"income":{"type":"array","items":{"type":"object","properties":{"accountCode":{"type":"string"},"name":{"type":"string"},"amountCents":{"type":"number"}},"required":["accountCode","name","amountCents"]}},"expense":{"type":"array","items":{"type":"object","properties":{"accountCode":{"type":"string"},"name":{"type":"string"},"amountCents":{"type":"number"}},"required":["accountCode","name","amountCents"]}},"totalIncome":{"type":"number"},"totalExpense":{"type":"number"},"netProfitCents":{"type":"number"}},"required":["currency","income","expense","totalIncome","totalExpense","netProfitCents"]},"BalanceSheetResponse":{"type":"object","properties":{"currency":{"type":"string"},"assets":{"type":"array","items":{"type":"object","properties":{"accountCode":{"type":"string"},"name":{"type":"string"},"amountCents":{"type":"number"}},"required":["accountCode","name","amountCents"]}},"liabilities":{"type":"array","items":{"type":"object","properties":{"accountCode":{"type":"string"},"name":{"type":"string"},"amountCents":{"type":"number"}},"required":["accountCode","name","amountCents"]}},"equity":{"type":"array","items":{"type":"object","properties":{"accountCode":{"type":"string"},"name":{"type":"string"},"amountCents":{"type":"number"}},"required":["accountCode","name","amountCents"]}},"retainedEarningsCents":{"type":"number"},"totalAssets":{"type":"number"},"totalLiabilities":{"type":"number"},"totalEquity":{"type":"number"},"balanced":{"type":"boolean"}},"required":["currency","assets","liabilities","equity","retainedEarningsCents","totalAssets","totalLiabilities","totalEquity","balanced"]},"CashFlowResponse":{"type":"object","properties":{"currency":{"type":"string"},"cashCodes":{"type":"array","items":{"type":"string"}},"inflowCents":{"type":"number"},"outflowCents":{"type":"number"},"netChangeCents":{"type":"number"}},"required":["currency","cashCodes","inflowCents","outflowCents","netChangeCents"]},"CustomerResponse":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"isActive":{"type":"boolean"}},"required":["id","name","isActive"]},"CustomersResponse":{"type":"object","properties":{"customers":{"type":"array","items":{"$ref":"#/components/schemas/CustomerResponse"}}},"required":["customers"]},"CreateCustomerRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"example":"Beta Sdn Bhd"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"billingAddress":{"type":"string"}},"required":["name"]},"SupplierResponse":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"isActive":{"type":"boolean"}},"required":["id","name","isActive"]},"SuppliersResponse":{"type":"object","properties":{"suppliers":{"type":"array","items":{"$ref":"#/components/schemas/SupplierResponse"}}},"required":["suppliers"]},"CreateSupplierRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"example":"Acme Supplies"},"email":{"type":"string","format":"email"},"phone":{"type":"string"}},"required":["name"]},"ArInvoicesResponse":{"type":"object","properties":{"invoices":{"type":"array","items":{"$ref":"#/components/schemas/ArInvoiceResponse"}}},"required":["invoices"]},"PostArInvoiceRequest":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"date":{"type":"string","format":"date-time"},"dueDate":{"type":"string","format":"date-time"},"memo":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"accountCode":{"type":"string","minLength":1},"amountCents":{"type":"integer","exclusiveMinimum":0},"taxCode":{"type":"string"},"taxRatePct":{"type":"number","minimum":0}},"required":["description","accountCode","amountCents"]},"minItems":1},"currency":{"type":"string"},"fxRate":{"type":"number","exclusiveMinimum":0}},"required":["customerId","lines"]},"PaymentRequest":{"type":"object","properties":{"amountCents":{"type":"integer","exclusiveMinimum":0},"bankCode":{"type":"string","example":"1010"},"date":{"type":"string","format":"date-time"},"fxRate":{"type":"number","exclusiveMinimum":0}},"required":["amountCents"]},"ApBillResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"supplierName":{"type":"string"},"totalCents":{"type":"number"},"amountPaidCents":{"type":"number"},"status":{"type":"string"},"journalEntryId":{"type":"string"}},"required":["id","number","supplierName","totalCents","amountPaidCents","status"]},"ApBillsResponse":{"type":"object","properties":{"bills":{"type":"array","items":{"$ref":"#/components/schemas/ApBillResponse"}}},"required":["bills"]},"PostApBillRequest":{"type":"object","properties":{"supplierId":{"type":"string","minLength":1},"date":{"type":"string","format":"date-time"},"dueDate":{"type":"string","format":"date-time"},"memo":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"accountCode":{"type":"string","minLength":1},"amountCents":{"type":"integer","exclusiveMinimum":0},"taxCode":{"type":"string"},"taxRatePct":{"type":"number","minimum":0}},"required":["description","accountCode","amountCents"]},"minItems":1}},"required":["supplierId","lines"]},"MemberResponse":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"phone":{"type":"string"},"pointsBalance":{"type":"number"},"tier":{"type":"string"}},"required":["id","name","pointsBalance","tier"]},"MembersResponse":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/MemberResponse"}}},"required":["members"]},"CreateMemberRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1},"phone":{"type":"string"},"email":{"type":"string","format":"email"}},"required":["name"]},"PosOrderResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"outletName":{"type":"string"},"subtotalCents":{"type":"number"},"discountCents":{"type":"number"},"totalCents":{"type":"number"},"paymentMethod":{"type":"string"},"pointsEarned":{"type":"number"},"status":{"type":"string"}},"required":["id","number","outletName","subtotalCents","discountCents","totalCents","paymentMethod","pointsEarned","status"]},"PosOrdersResponse":{"type":"object","properties":{"orders":{"type":"array","items":{"$ref":"#/components/schemas/PosOrderResponse"}}},"required":["orders"]},"PosCheckoutRequest":{"type":"object","properties":{"outletLocationId":{"type":"string","minLength":1},"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unitPriceCents":{"type":"integer","minimum":0}},"required":["productId","quantity"]},"minItems":1},"discountCents":{"type":"integer","minimum":0},"paymentMethod":{"type":"string","enum":["cash","card","ewallet"]},"memberId":{"type":"string"}},"required":["outletLocationId","lines"]},"LocationResponse":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"}},"required":["id","code","name","type"]},"LocationsResponse":{"type":"object","properties":{"locations":{"type":"array","items":{"$ref":"#/components/schemas/LocationResponse"}}},"required":["locations"]},"CreateLocationRequest":{"type":"object","properties":{"code":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"type":{"type":"string","enum":["warehouse","outlet","van"]}},"required":["code","name"]},"StockLevelsResponse":{"type":"object","properties":{"levels":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"sku":{"type":"string"},"productName":{"type":"string"},"locationId":{"type":"string"},"locationName":{"type":"string"},"qty":{"type":"number"},"avgCostCents":{"type":"number"},"valueCents":{"type":"number"}},"required":["productId","sku","productName","locationId","locationName","qty","avgCostCents","valueCents"]}}},"required":["levels"]},"ReceiptRequest":{"type":"object","properties":{"productId":{"type":"string","minLength":1},"locationId":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unitCostCents":{"type":"integer","minimum":0},"batchNo":{"type":"string"},"serialNo":{"type":"string"},"reason":{"type":"string"}},"required":["productId","locationId","quantity","unitCostCents"]},"IssueRequest":{"type":"object","properties":{"productId":{"type":"string","minLength":1},"locationId":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"reason":{"type":"string"}},"required":["productId","locationId","quantity"]},"TransferRequest":{"type":"object","properties":{"productId":{"type":"string","minLength":1},"fromLocationId":{"type":"string","minLength":1},"toLocationId":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0}},"required":["productId","fromLocationId","toLocationId","quantity"]},"StockTakeRequest":{"type":"object","properties":{"productId":{"type":"string","minLength":1},"locationId":{"type":"string","minLength":1},"countedQty":{"type":"number","minimum":0},"postToGl":{"type":"boolean"}},"required":["productId","locationId","countedQty"]},"ItemLookupResponse":{"type":"object","properties":{"id":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"barcode":{"type":"string"},"unitPriceCents":{"type":"number"},"levels":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"sku":{"type":"string"},"productName":{"type":"string"},"locationId":{"type":"string"},"locationName":{"type":"string"},"qty":{"type":"number"},"avgCostCents":{"type":"number"},"valueCents":{"type":"number"}},"required":["productId","sku","productName","locationId","locationName","qty","avgCostCents","valueCents"]}}},"required":["id","sku","name","unitPriceCents","levels"]},"RequisitionResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"type":"string"}},"required":["id","number","status"]},"RequisitionsResponse":{"type":"object","properties":{"requisitions":{"type":"array","items":{"$ref":"#/components/schemas/RequisitionResponse"}}},"required":["requisitions"]},"CreateRequisitionRequest":{"type":"object","properties":{"note":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"estUnitPriceCents":{"type":"integer","minimum":0},"accountCode":{"type":"string"}},"required":["description","quantity"]},"minItems":1}},"required":["lines"]},"PurchaseOrderResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"supplierName":{"type":"string"},"totalCents":{"type":"number"},"status":{"type":"string"}},"required":["id","number","supplierName","totalCents","status"]},"PurchaseOrdersResponse":{"type":"object","properties":{"purchaseOrders":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderResponse"}}},"required":["purchaseOrders"]},"CreatePurchaseOrderRequest":{"type":"object","properties":{"supplierId":{"type":"string","minLength":1},"fromRequisitionId":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"accountCode":{"type":"string"},"quantity":{"type":"number","exclusiveMinimum":0},"unitPriceCents":{"type":"integer","minimum":0}},"required":["description","quantity","unitPriceCents"]}}},"required":["supplierId"]},"GoodsReceiptResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"supplierName":{"type":"string"}},"required":["id","number","supplierName"]},"ReceiveGoodsRequest":{"type":"object","properties":{"quantities":{"type":"array","items":{"type":"number","minimum":0}}}},"GoodsReceiptsResponse":{"type":"object","properties":{"goodsReceipts":{"type":"array","items":{"$ref":"#/components/schemas/GoodsReceiptResponse"}}},"required":["goodsReceipts"]},"ProductResponse":{"type":"object","properties":{"id":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"unitPriceCents":{"type":"number"},"incomeAccountCode":{"type":"string"}},"required":["id","sku","name","unitPriceCents","incomeAccountCode"]},"ProductsResponse":{"type":"object","properties":{"products":{"type":"array","items":{"$ref":"#/components/schemas/ProductResponse"}}},"required":["products"]},"CreateProductRequest":{"type":"object","properties":{"sku":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"barcode":{"type":"string"},"unitPriceCents":{"type":"integer","minimum":0},"incomeAccountCode":{"type":"string"}},"required":["sku","name","unitPriceCents"]},"SalesDocResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"customerName":{"type":"string"},"totalCents":{"type":"number"},"status":{"type":"string"}},"required":["id","number","customerName","totalCents","status"]},"QuotationsResponse":{"type":"object","properties":{"quotations":{"type":"array","items":{"$ref":"#/components/schemas/SalesDocResponse"}}},"required":["quotations"]},"CreateQuotationRequest":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"validUntil":{"type":"string","format":"date-time"},"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"description":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unitPriceCents":{"type":"integer","minimum":0},"accountCode":{"type":"string"}},"required":["description","quantity","unitPriceCents"]},"minItems":1}},"required":["customerId","lines"]},"SalesOrdersResponse":{"type":"object","properties":{"salesOrders":{"type":"array","items":{"$ref":"#/components/schemas/SalesDocResponse"}}},"required":["salesOrders"]},"CreateSalesOrderRequest":{"type":"object","properties":{"customerId":{"type":"string"},"fromQuotationId":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"description":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unitPriceCents":{"type":"integer","minimum":0},"accountCode":{"type":"string"}},"required":["description","quantity","unitPriceCents"]}}}},"DeliveryOrderResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"customerName":{"type":"string"},"status":{"type":"string"}},"required":["id","number","customerName","status"]},"DeliveryOrdersResponse":{"type":"object","properties":{"deliveryOrders":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryOrderResponse"}}},"required":["deliveryOrders"]},"CustomerInsightsResponse":{"type":"object","properties":{"insights":{"type":"array","items":{"type":"object","properties":{"customerId":{"type":"string"},"name":{"type":"string"},"orders":{"type":"integer"},"recencyDays":{"type":["integer","null"]},"monetaryCents":{"type":"integer"},"score":{"type":"integer"},"segment":{"type":"string","enum":["champion","loyal","active","at_risk","dormant","prospect"]},"nextBestAction":{"type":"string"}},"required":["customerId","name","orders","recencyDays","monetaryCents","score","segment","nextBestAction"]}}},"required":["insights"]},"CustomerNoteResponse":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"body":{"type":"string"},"author":{"type":"string"},"sentiment":{"type":"string","enum":["positive","neutral","negative"]},"sentimentScore":{"type":"integer"},"at":{"type":"string"}},"required":["id","customerId","body","sentiment","sentimentScore","at"]},"CustomerNotesResponse":{"type":"object","properties":{"notes":{"type":"array","items":{"$ref":"#/components/schemas/CustomerNoteResponse"}}},"required":["notes"]},"AddCustomerNoteRequest":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"body":{"type":"string","minLength":1}},"required":["customerId","body"]},"UserSummary":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"},"roles":{"type":"array","items":{"type":"string"}},"status":{"type":"string"}},"required":["id","email","name","roles","status"]},"UsersResponse":{"type":"object","properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/UserSummary"}}},"required":["users"]},"TenantResponse":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["provisioning","active","suspended","offboarded"]},"plan":{"type":"string","enum":["starter","growth","enterprise"]},"region":{"type":"string","enum":["MY","SG"]}},"required":["id","slug","name","status","plan","region"]},"SignupRequest":{"type":"object","properties":{"tenantName":{"type":"string","minLength":2,"example":"Acme Sdn Bhd"},"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z0-9-]+$","example":"acme"},"region":{"type":"string","enum":["MY","SG"],"default":"MY"},"adminEmail":{"type":"string","format":"email","example":"owner@acme.com"},"adminName":{"type":"string","minLength":2,"example":"Jane Tan"},"password":{"type":"string","minLength":8}},"required":["tenantName","slug","adminEmail","adminName","password"]},"TenantExportResponse":{"type":"object","properties":{"tenant":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"plan":{"type":"string"},"region":{"type":"string"}},"required":["id","slug","name","status","plan","region"]},"exportedAt":{"type":"string"},"counts":{"type":"object","additionalProperties":{"type":"number"}},"totalDocuments":{"type":"number"},"collections":{"type":"object","additionalProperties":{"type":"array","items":{}}}},"required":["tenant","exportedAt","counts","totalDocuments","collections"]},"OffboardTenantResponse":{"type":"object","properties":{"tenant":{"$ref":"#/components/schemas/TenantResponse"},"purge":{"type":"object","properties":{"totalDeleted":{"type":"number"},"deleted":{"type":"object","additionalProperties":{"type":"number"}}},"required":["totalDeleted","deleted"]}},"required":["tenant"]},"OffboardTenantRequest":{"type":"object","properties":{"purge":{"type":"boolean"},"confirm":{"type":"string","example":"OFFBOARD"}},"required":["confirm"]},"ReportSourcesResponse":{"type":"object","properties":{"sources":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"hasDateRange":{"type":"boolean"},"dimensions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"}},"required":["key","label"]}},"measures":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"money":{"type":"boolean"}},"required":["key","label"]}}},"required":["key","label","dimensions","measures"]}}},"required":["sources"]},"ReportResultResponse":{"type":"object","properties":{"columns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"money":{"type":"boolean"}},"required":["key","label"]}},"rows":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["columns","rows"]},"ReportSpecRequest":{"type":"object","properties":{"source":{"type":"string"},"dimensions":{"type":"array","items":{"type":"string"},"default":[]},"measures":{"type":"array","items":{"type":"string"},"default":[]},"filters":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"value":{"type":"string"}},"required":["field","value"]}},"dateFrom":{"type":"string"},"dateTo":{"type":"string"},"sort":{"type":"string"},"limit":{"type":"integer","exclusiveMinimum":0,"maximum":1000}},"required":["source"]},"ReportDefinitionResponse":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"source":{"type":"string"},"dimensions":{"type":"array","items":{"type":"string"}},"measures":{"type":"array","items":{"type":"string"}},"filters":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"value":{"type":"string"}},"required":["field","value"]}},"sort":{"type":"string"},"limit":{"type":"integer"},"dateFrom":{"type":"string"},"dateTo":{"type":"string"}},"required":["id","name","source","dimensions","measures","filters","limit"]},"ReportDefinitionsResponse":{"type":"object","properties":{"reports":{"type":"array","items":{"$ref":"#/components/schemas/ReportDefinitionResponse"}}},"required":["reports"]},"CreateReportRequest":{"allOf":[{"$ref":"#/components/schemas/ReportSpecRequest"},{"type":"object","properties":{"name":{"type":"string","minLength":1}},"required":["name"]}]},"SetReportScheduleRequest":{"type":"object","properties":{"schedule":{"type":"string","enum":["none","daily","weekly","monthly"]}},"required":["schedule"]},"ReportSnapshotResponse":{"type":"object","properties":{"id":{"type":"string"},"reportId":{"type":"string"},"name":{"type":"string"},"rowCount":{"type":"integer"},"runAt":{"type":"string"}},"required":["id","reportId","name","rowCount","runAt"]},"ReportSnapshotsResponse":{"type":"object","properties":{"snapshots":{"type":"array","items":{"$ref":"#/components/schemas/ReportSnapshotResponse"}}},"required":["snapshots"]},"ExportReportRequest":{"type":"object","properties":{"spec":{"$ref":"#/components/schemas/ReportSpecRequest"},"format":{"type":"string","enum":["csv","pdf"]},"title":{"type":"string"}},"required":["spec","format"]},"WebhookResponse":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"description":{"type":"string"},"active":{"type":"boolean"},"secret":{"type":"string"}},"required":["id","url","events","active"]},"WebhooksResponse":{"type":"object","properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/WebhookResponse"}},"events":{"type":"array","items":{"type":"string"}}},"required":["webhooks","events"]},"CreateWebhookRequest":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"},"minItems":1},"description":{"type":"string"},"secret":{"type":"string"}},"required":["url","events"]},"UpdateWebhookRequest":{"type":"object","properties":{"active":{"type":"boolean"}},"required":["active"]},"WebhookDeliveryResponse":{"type":"object","properties":{"id":{"type":"string"},"subscriptionId":{"type":"string"},"event":{"type":"string"},"url":{"type":"string"},"status":{"type":"string","enum":["pending","delivered","failed"]},"attempts":{"type":"number"},"responseStatus":{"type":"number"},"error":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","subscriptionId","event","url","status","attempts"]},"WebhookDeliveriesResponse":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDeliveryResponse"}}},"required":["deliveries"]},"DashboardWidgetMeta":{"type":"object","properties":{"key":{"type":"string"},"title":{"type":"string"},"module":{"type":"string"},"type":{"type":"string","enum":["stat","list"]},"link":{"type":"string"}},"required":["key","title","module","type","link"]},"DashboardWidgetsResponse":{"type":"object","properties":{"widgets":{"type":"array","items":{"$ref":"#/components/schemas/DashboardWidgetMeta"}}},"required":["widgets"]},"DashboardLayoutResponse":{"type":"object","properties":{"widgets":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"w":{"type":"integer","minimum":1,"maximum":12},"h":{"type":"integer","minimum":1,"maximum":4}},"required":["key","w","h"]}}},"required":["widgets"]},"SaveDashboardLayoutRequest":{"type":"object","properties":{"widgets":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"w":{"type":"integer","minimum":1,"maximum":12},"h":{"type":"integer","minimum":1,"maximum":4}},"required":["key","w","h"]},"maxItems":40}},"required":["widgets"]},"DashboardDataResponse":{"type":"object","properties":{"widgets":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"title":{"type":"string"},"type":{"type":"string","enum":["stat","list"]},"link":{"type":"string"},"data":{"type":"object","additionalProperties":{}}},"required":["key","title","type","link","data"]}}},"required":["widgets"]},"MarketplaceApp":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"category":{"type":"string"},"description":{"type":"string"},"publisher":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"monthlyPriceCents":{"type":"integer"},"revSharePct":{"type":"number"}},"required":["key","name","category","description","publisher","scopes"]},"MarketplaceCatalogResponse":{"type":"object","properties":{"apps":{"type":"array","items":{"$ref":"#/components/schemas/MarketplaceApp"}}},"required":["apps"]},"AppInstallationResponse":{"type":"object","properties":{"appKey":{"type":"string"},"status":{"type":"string","enum":["installed","disabled"]}},"required":["appKey","status"]},"AppInstallationsResponse":{"type":"object","properties":{"installations":{"type":"array","items":{"$ref":"#/components/schemas/AppInstallationResponse"}}},"required":["installations"]},"InstallAppRequest":{"type":"object","properties":{"appKey":{"type":"string","minLength":1},"config":{"type":"object","additionalProperties":{}}},"required":["appKey"]},"UpdateAppRequest":{"type":"object","properties":{"status":{"type":"string","enum":["installed","disabled"]}},"required":["status"]},"DeveloperAppResponse":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"clientId":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"redirectUris":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","revoked"]},"lastUsedAt":{"type":"string"},"clientSecret":{"type":"string"}},"required":["id","name","clientId","scopes","redirectUris","status"]},"DeveloperAppsResponse":{"type":"object","properties":{"apps":{"type":"array","items":{"$ref":"#/components/schemas/DeveloperAppResponse"}}},"required":["apps"]},"RegisterDeveloperAppRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1},"scopes":{"type":"array","items":{"type":"string"}},"redirectUris":{"type":"array","items":{"type":"string"}}},"required":["name"]},"RevShareResponse":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object","properties":{"appKey":{"type":"string"},"name":{"type":"string"},"publisher":{"type":"string"},"installs":{"type":"number"},"monthlyPriceCents":{"type":"number"},"grossCents":{"type":"number"},"publisherCents":{"type":"number"},"platformCents":{"type":"number"}},"required":["appKey","name","publisher","installs","monthlyPriceCents","grossCents","publisherCents","platformCents"]}},"byPublisher":{"type":"array","items":{"type":"object","properties":{"publisher":{"type":"string"},"grossCents":{"type":"number"},"publisherCents":{"type":"number"},"platformCents":{"type":"number"}},"required":["publisher","grossCents","publisherCents","platformCents"]}},"grossCents":{"type":"number"},"publisherCents":{"type":"number"},"platformCents":{"type":"number"}},"required":["rows","byPublisher","grossCents","publisherCents","platformCents"]},"OAuthTokenResponse":{"type":"object","properties":{"access_token":{"type":"string"},"token_type":{"type":"string","enum":["Bearer"]},"expires_in":{"type":"number"},"scope":{"type":"string"}},"required":["access_token","token_type","expires_in","scope"]},"OAuthTokenRequest":{"type":"object","properties":{"grant_type":{"type":"string","enum":["client_credentials"]},"client_id":{"type":"string","minLength":1},"client_secret":{"type":"string","minLength":1}},"required":["grant_type","client_id","client_secret"]},"LocalisationProfile":{"type":"object","properties":{"region":{"type":"string","enum":["MY","SG","ID","TH"]},"country":{"type":"string"},"currency":{"type":"string"},"taxSystem":{"type":"string"},"standardRatePct":{"type":"number"},"taxCodes":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"label":{"type":"string"},"ratePct":{"type":"number"}},"required":["code","label","ratePct"]}},"eInvoiceFormat":{"type":"string"},"payrollScheme":{"type":"string"},"locale":{"type":"string"},"decimalPlaces":{"type":"integer"}},"required":["region","country","currency","taxSystem","standardRatePct","taxCodes","eInvoiceFormat","payrollScheme","locale","decimalPlaces"]},"LocalisationProfilesResponse":{"type":"object","properties":{"profiles":{"type":"array","items":{"$ref":"#/components/schemas/LocalisationProfile"}}},"required":["profiles"]},"ActiveLocalisationResponse":{"type":"object","properties":{"region":{"type":"string"},"profile":{"$ref":"#/components/schemas/LocalisationProfile"}},"required":["region","profile"]},"ProjectResponse":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"customerId":{"type":"string"},"customerName":{"type":"string"},"status":{"type":"string","enum":["active","closed"]},"billingType":{"type":"string"},"defaultRateCents":{"type":"integer"},"budgetCents":{"type":"integer"}},"required":["id","code","name","customerId","customerName","status","billingType","defaultRateCents","budgetCents"]},"ProjectsResponse":{"type":"object","properties":{"projects":{"type":"array","items":{"$ref":"#/components/schemas/ProjectResponse"}}},"required":["projects"]},"CreateProjectRequest":{"type":"object","properties":{"code":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"customerId":{"type":"string","minLength":1},"billingType":{"type":"string","enum":["time_and_materials","fixed"]},"defaultRateCents":{"type":"integer","minimum":0},"budgetCents":{"type":"integer","minimum":0},"incomeAccountCode":{"type":"string"}},"required":["code","name","customerId"]},"TimeEntryResponse":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"date":{"type":"string"},"hours":{"type":"number"},"description":{"type":"string"},"billable":{"type":"boolean"},"rateCents":{"type":"integer"},"billed":{"type":"boolean"}},"required":["id","projectId","date","hours","billable","rateCents","billed"]},"ProjectDetailResponse":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/ProjectResponse"},"entries":{"type":"array","items":{"$ref":"#/components/schemas/TimeEntryResponse"}},"summary":{"type":"object","properties":{"totalHours":{"type":"number"},"billableHours":{"type":"number"},"unbilledCents":{"type":"integer"},"billedCents":{"type":"integer"},"costCents":{"type":"integer"},"marginCents":{"type":"integer"},"milestoneBilledCents":{"type":"integer"},"milestonePendingCents":{"type":"integer"},"budgetCents":{"type":"integer"},"budgetRemainingCents":{"type":"integer"}},"required":["totalHours","billableHours","unbilledCents","billedCents","budgetCents","budgetRemainingCents"]},"milestones":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"amountCents":{"type":"integer"},"status":{"type":"string","enum":["pending","billed"]},"arInvoiceId":{"type":"string"}},"required":["id","name","amountCents","status"]}},"expenses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"description":{"type":"string"},"amountCents":{"type":"integer"},"billable":{"type":"boolean"},"billed":{"type":"boolean"}},"required":["id","description","amountCents","billable","billed"]}}},"required":["project","entries","summary"]},"LogTimeRequest":{"type":"object","properties":{"hours":{"type":"number","exclusiveMinimum":0},"date":{"type":"string"},"description":{"type":"string"},"billable":{"type":"boolean"},"rateCents":{"type":"integer","minimum":0}},"required":["hours"]},"MilestoneResponse":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"name":{"type":"string"},"amountCents":{"type":"integer"},"status":{"type":"string","enum":["pending","billed"]},"arInvoiceId":{"type":"string"}},"required":["id","projectId","name","amountCents","status"]},"AddMilestoneRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1},"amountCents":{"type":"integer","exclusiveMinimum":0},"dueDate":{"type":"string"}},"required":["name","amountCents"]},"ProjectExpenseResponse":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"description":{"type":"string"},"amountCents":{"type":"integer"},"billable":{"type":"boolean"},"billed":{"type":"boolean"}},"required":["id","projectId","description","amountCents","billable","billed"]},"RecordProjectExpenseRequest":{"type":"object","properties":{"description":{"type":"string","minLength":1},"amountCents":{"type":"integer","exclusiveMinimum":0},"accountCode":{"type":"string"},"billable":{"type":"boolean"}},"required":["description","amountCents"]},"BinResponse":{"type":"object","properties":{"id":{"type":"string"},"locationId":{"type":"string"},"code":{"type":"string"},"zone":{"type":"string"},"isActive":{"type":"boolean"}},"required":["id","locationId","code","isActive"]},"BinsResponse":{"type":"object","properties":{"bins":{"type":"array","items":{"$ref":"#/components/schemas/BinResponse"}}},"required":["bins"]},"CreateBinRequest":{"type":"object","properties":{"locationId":{"type":"string","minLength":1},"code":{"type":"string","minLength":1},"zone":{"type":"string"}},"required":["locationId","code"]},"BinStockResponse":{"type":"object","properties":{"id":{"type":"string"},"productId":{"type":"string"},"sku":{"type":"string"},"locationId":{"type":"string"},"binCode":{"type":"string"},"qty":{"type":"number"}},"required":["id","productId","locationId","binCode","qty"]},"BinStockListResponse":{"type":"object","properties":{"stock":{"type":"array","items":{"$ref":"#/components/schemas/BinStockResponse"}}},"required":["stock"]},"PutawayRequest":{"type":"object","properties":{"productId":{"type":"string","minLength":1},"locationId":{"type":"string","minLength":1},"binCode":{"type":"string","minLength":1},"qty":{"type":"integer","exclusiveMinimum":0}},"required":["productId","locationId","binCode","qty"]},"MoveBinRequest":{"type":"object","properties":{"productId":{"type":"string","minLength":1},"locationId":{"type":"string","minLength":1},"fromBin":{"type":"string","minLength":1},"toBin":{"type":"string","minLength":1},"qty":{"type":"integer","exclusiveMinimum":0}},"required":["productId","locationId","fromBin","toBin","qty"]},"WaveResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"locationId":{"type":"string"},"fulfillmentIds":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["open","picked","cancelled"]},"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"totalQty":{"type":"number"},"binCode":{"type":"string"}},"required":["productId","name","totalQty"]}},"pickedAt":{"type":"string"}},"required":["id","number","locationId","fulfillmentIds","status","lines"]},"WavesResponse":{"type":"object","properties":{"waves":{"type":"array","items":{"$ref":"#/components/schemas/WaveResponse"}}},"required":["waves"]},"CreateWaveRequest":{"type":"object","properties":{"fulfillmentIds":{"type":"array","items":{"type":"string","minLength":1},"minItems":1}},"required":["fulfillmentIds"]},"CompleteWaveRequest":{"type":"object","properties":{"picks":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"binCode":{"type":"string"}},"required":["index"]}}}},"RouteTripResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"vanLocationId":{"type":"string"},"vanLocationName":{"type":"string"},"sourceLocationId":{"type":"string"},"salesperson":{"type":"string"},"status":{"type":"string","enum":["loading","active","settled","cancelled"]},"loads":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"qty":{"type":"number"}},"required":["productId","name","qty"]}},"sales":{"type":"array","items":{"type":"object","properties":{"customerName":{"type":"string"},"totalCents":{"type":"number"},"paymentMethod":{"type":"string","enum":["cash","credit"]},"arInvoiceId":{"type":"string"}},"required":["customerName","totalCents","paymentMethod"]}}},"required":["id","number","vanLocationId","sourceLocationId","status","loads","sales"]},"RouteTripsResponse":{"type":"object","properties":{"trips":{"type":"array","items":{"$ref":"#/components/schemas/RouteTripResponse"}}},"required":["trips"]},"CreateRouteTripRequest":{"type":"object","properties":{"vanLocationId":{"type":"string","minLength":1},"sourceLocationId":{"type":"string","minLength":1},"salesperson":{"type":"string"}},"required":["vanLocationId","sourceLocationId"]},"LoadVanRequest":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","minLength":1},"qty":{"type":"integer","exclusiveMinimum":0}},"required":["productId","qty"]},"minItems":1}},"required":["items"]},"RouteSaleRequest":{"type":"object","properties":{"customerId":{"type":"string"},"paymentMethod":{"type":"string","enum":["cash","credit"]},"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","minLength":1},"qty":{"type":"integer","exclusiveMinimum":0},"unitPriceCents":{"type":"integer","exclusiveMinimum":0}},"required":["productId","qty","unitPriceCents"]},"minItems":1}},"required":["lines"]},"RouteReconLine":{"type":"object","properties":{"productId":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"loadedQty":{"type":"number"},"soldQty":{"type":"number"},"returnedQty":{"type":"number"}},"required":["productId","name","loadedQty","soldQty","returnedQty"]},"SettleRouteResponse":{"type":"object","properties":{"trip":{"$ref":"#/components/schemas/RouteTripResponse"},"reconciliation":{"type":"array","items":{"$ref":"#/components/schemas/RouteReconLine"}}},"required":["trip","reconciliation"]},"FulfillmentResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"salesOrderId":{"type":"string"},"salesOrderNumber":{"type":"string"},"customerName":{"type":"string"},"locationId":{"type":"string"},"status":{"type":"string","enum":["picking","packed","shipped","cancelled"]},"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"},"binCode":{"type":"string"},"picked":{"type":"boolean"}},"required":["productId","name","quantity","picked"]}},"carrier":{"type":"string"},"trackingNo":{"type":"string"},"shippedAt":{"type":"string"}},"required":["id","number","salesOrderId","customerName","locationId","status","lines"]},"FulfillmentsResponse":{"type":"object","properties":{"fulfillments":{"type":"array","items":{"$ref":"#/components/schemas/FulfillmentResponse"}}},"required":["fulfillments"]},"CreateFulfillmentRequest":{"type":"object","properties":{"salesOrderId":{"type":"string","minLength":1},"locationId":{"type":"string","minLength":1}},"required":["salesOrderId","locationId"]},"PackFulfillmentRequest":{"type":"object","properties":{"picks":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"binCode":{"type":"string"}},"required":["index"]}}}},"ShipFulfillmentRequest":{"type":"object","properties":{"carrier":{"type":"string"},"trackingNo":{"type":"string"}}},"ReorderRecommendation":{"type":"object","properties":{"productId":{"type":"string"},"sku":{"type":"string"},"productName":{"type":"string"},"onHand":{"type":"number"},"avgDailyDemand":{"type":"number"},"leadTimeDays":{"type":"number"},"reorderPointQty":{"type":"number"},"safetyStockQty":{"type":"number"},"positionQty":{"type":"number"},"shouldReorder":{"type":"boolean"},"suggestedOrderQty":{"type":"number"},"daysOfCover":{"type":"number"}},"required":["productId","sku","productName","onHand","avgDailyDemand","leadTimeDays","reorderPointQty","safetyStockQty","positionQty","shouldReorder","suggestedOrderQty","daysOfCover"]},"ReorderRecommendationsResponse":{"type":"object","properties":{"recommendations":{"type":"array","items":{"$ref":"#/components/schemas/ReorderRecommendation"}}},"required":["recommendations"]},"DemandForecastResponse":{"type":"object","properties":{"productId":{"type":"string"},"sku":{"type":"string"},"productName":{"type":"string"},"history":{"type":"array","items":{"type":"number"}},"result":{"type":"object","properties":{"method":{"type":"string","enum":["moving_average","linear_trend"]},"forecast":{"type":"array","items":{"type":"number"}},"mape":{"type":["number","null"]},"average":{"type":"number"}},"required":["method","forecast","mape","average"]}},"required":["productId","sku","productName","history","result"]},"BomResponse":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"productId":{"type":"string"},"productSku":{"type":"string"},"productName":{"type":"string"},"outputQty":{"type":"number"},"components":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"}},"required":["productId","sku","name","quantity"]}},"laborCostCents":{"type":"integer"},"overheadCostCents":{"type":"integer"},"status":{"type":"string","enum":["active","archived"]}},"required":["id","name","productId","productSku","productName","outputQty","components","laborCostCents","overheadCostCents","status"]},"BomsResponse":{"type":"object","properties":{"boms":{"type":"array","items":{"$ref":"#/components/schemas/BomResponse"}}},"required":["boms"]},"CreateBomRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1},"productId":{"type":"string","minLength":1},"outputQty":{"type":"number","exclusiveMinimum":0},"components":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0}},"required":["productId","quantity"]},"minItems":1},"laborCostCents":{"type":"integer","minimum":0},"overheadCostCents":{"type":"integer","minimum":0}},"required":["name","productId","components"]},"WorkOrderResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"bomId":{"type":"string"},"productId":{"type":"string"},"productSku":{"type":"string"},"productName":{"type":"string"},"quantity":{"type":"number"},"locationId":{"type":"string"},"status":{"type":"string","enum":["open","completed","cancelled"]},"qcStatus":{"type":"string","enum":["not_required","pending","passed","failed"]},"qcNotes":{"type":"string"},"consumed":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"},"unitCostCents":{"type":"integer"},"totalCostCents":{"type":"integer"}},"required":["productId","sku","name","quantity","unitCostCents","totalCostCents"]}},"componentCostCents":{"type":"integer"},"laborCostCents":{"type":"integer"},"overheadCostCents":{"type":"integer"},"totalCostCents":{"type":"integer"},"unitCostCents":{"type":"integer"},"journalEntryId":{"type":"string"},"completedAt":{"type":"string"}},"required":["id","number","bomId","productId","productSku","productName","quantity","locationId","status","consumed","componentCostCents","laborCostCents","overheadCostCents","totalCostCents","unitCostCents"]},"WorkOrdersResponse":{"type":"object","properties":{"workOrders":{"type":"array","items":{"$ref":"#/components/schemas/WorkOrderResponse"}}},"required":["workOrders"]},"CreateWorkOrderRequest":{"type":"object","properties":{"bomId":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"locationId":{"type":"string","minLength":1},"requiresQc":{"type":"boolean"}},"required":["bomId","quantity","locationId"]},"WorkOrderQcRequest":{"type":"object","properties":{"pass":{"type":"boolean"},"notes":{"type":"string"}},"required":["pass"]},"ExplodedComponent":{"type":"object","properties":{"productId":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"},"isSubAssembly":{"type":"boolean"}},"required":["productId","sku","name","quantity","isSubAssembly"]},"ExplodeResponse":{"type":"object","properties":{"components":{"type":"array","items":{"$ref":"#/components/schemas/ExplodedComponent"}}},"required":["components"]},"MaterialRequirement":{"allOf":[{"$ref":"#/components/schemas/ExplodedComponent"},{"type":"object","properties":{"onHandQty":{"type":"number"},"netQty":{"type":"number"}},"required":["onHandQty","netQty"]}]},"MrpResponse":{"type":"object","properties":{"requirements":{"type":"array","items":{"$ref":"#/components/schemas/MaterialRequirement"}}},"required":["requirements"]},"EmployeeResponse":{"type":"object","properties":{"id":{"type":"string"},"employeeNo":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"department":{"type":"string"},"designation":{"type":"string"},"status":{"type":"string","enum":["active","terminated"]},"basicSalaryCents":{"type":"integer"},"allowancesCents":{"type":"integer"},"age":{"type":"integer"},"category":{"type":"string","enum":["local","permanent_resident","foreign"]},"epfEligible":{"type":"boolean"}},"required":["id","employeeNo","name","status","basicSalaryCents","allowancesCents","category","epfEligible"]},"EmployeesResponse":{"type":"object","properties":{"employees":{"type":"array","items":{"$ref":"#/components/schemas/EmployeeResponse"}}},"required":["employees"]},"CreateEmployeeRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email"},"department":{"type":"string"},"designation":{"type":"string"},"basicSalaryCents":{"type":"integer","minimum":0},"allowancesCents":{"type":"integer","minimum":0},"age":{"type":"integer","minimum":16,"maximum":100},"category":{"type":"string","enum":["local","permanent_resident","foreign"]},"epfEligible":{"type":"boolean"},"epfNo":{"type":"string"},"socsoNo":{"type":"string"},"taxNo":{"type":"string"},"bankName":{"type":"string"},"bankAccountNo":{"type":"string"}},"required":["name","basicSalaryCents"]},"UpdateEmployeeRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email"},"department":{"type":"string"},"designation":{"type":"string"},"basicSalaryCents":{"type":"integer","minimum":0},"allowancesCents":{"type":"integer","minimum":0},"age":{"type":"integer","minimum":16,"maximum":100},"category":{"type":"string","enum":["local","permanent_resident","foreign"]},"epfEligible":{"type":"boolean"},"epfNo":{"type":"string"},"socsoNo":{"type":"string"},"taxNo":{"type":"string"},"bankName":{"type":"string"},"bankAccountNo":{"type":"string"}}},"LeaveResponse":{"type":"object","properties":{"id":{"type":"string"},"employeeId":{"type":"string"},"employeeName":{"type":"string"},"type":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":"string"},"days":{"type":"number"},"reason":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]}},"required":["id","employeeId","employeeName","type","startDate","endDate","days","status"]},"LeavesResponse":{"type":"object","properties":{"leave":{"type":"array","items":{"$ref":"#/components/schemas/LeaveResponse"}}},"required":["leave"]},"RequestLeaveRequest":{"type":"object","properties":{"employeeId":{"type":"string","minLength":1},"type":{"type":"string","enum":["annual","sick","unpaid","maternity","compassionate"]},"startDate":{"type":"string"},"endDate":{"type":"string"},"days":{"type":"number","exclusiveMinimum":0},"reason":{"type":"string"}},"required":["employeeId","type","startDate","endDate"]},"DecideLeaveRequest":{"type":"object","properties":{"decision":{"type":"string","enum":["approved","rejected"]}},"required":["decision"]},"PayrollRunResponse":{"type":"object","properties":{"id":{"type":"string"},"periodKey":{"type":"string"},"region":{"type":"string","enum":["MY","SG","ID","TH"]},"status":{"type":"string","enum":["draft","posted"]},"payslips":{"type":"array","items":{"type":"object","properties":{"employeeId":{"type":"string"},"employeeNo":{"type":"string"},"employeeName":{"type":"string"},"grossWagesCents":{"type":"integer"},"allowancesCents":{"type":"integer"},"otherDeductionsCents":{"type":"integer"},"epfEmployeeCents":{"type":"integer"},"epfEmployerCents":{"type":"integer"},"socsoEmployeeCents":{"type":"integer"},"socsoEmployerCents":{"type":"integer"},"eisEmployeeCents":{"type":"integer"},"eisEmployerCents":{"type":"integer"},"pcbCents":{"type":"integer"},"employeeDeductionsCents":{"type":"integer"},"employerContributionsCents":{"type":"integer"},"netPayCents":{"type":"integer"},"employerCostCents":{"type":"integer"},"breakdown":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"label":{"type":"string"},"employeeCents":{"type":"integer"},"employerCents":{"type":"integer"}},"required":["code","label","employeeCents","employerCents"]}}},"required":["employeeId","employeeNo","employeeName","grossWagesCents","allowancesCents","otherDeductionsCents","epfEmployeeCents","epfEmployerCents","socsoEmployeeCents","socsoEmployerCents","eisEmployeeCents","eisEmployerCents","pcbCents","employeeDeductionsCents","employerContributionsCents","netPayCents","employerCostCents"]}},"grossCents":{"type":"integer"},"netCents":{"type":"integer"},"employeeDeductionsCents":{"type":"integer"},"employerContributionsCents":{"type":"integer"},"statutoryPayableCents":{"type":"integer"},"employerCostCents":{"type":"integer"},"journalEntryId":{"type":"string"},"postedAt":{"type":"string"}},"required":["id","periodKey","status","payslips","grossCents","netCents","employeeDeductionsCents","employerContributionsCents","statutoryPayableCents","employerCostCents"]},"PayrollRunsResponse":{"type":"object","properties":{"runs":{"type":"array","items":{"$ref":"#/components/schemas/PayrollRunResponse"}}},"required":["runs"]},"CreatePayrollRunRequest":{"type":"object","properties":{"periodKey":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$"}},"required":["periodKey"]},"AttendanceResponse":{"type":"object","properties":{"id":{"type":"string"},"employeeId":{"type":"string"},"employeeName":{"type":"string"},"date":{"type":"string"},"status":{"type":"string"},"hoursWorked":{"type":"number"},"note":{"type":"string"}},"required":["id","employeeId","date","status","hoursWorked"]},"AttendanceListResponse":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/AttendanceResponse"}}},"required":["records"]},"RecordAttendanceRequest":{"type":"object","properties":{"employeeId":{"type":"string","minLength":1},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"status":{"type":"string","enum":["present","absent","leave","holiday","rest"]},"hoursWorked":{"type":"number","minimum":0},"note":{"type":"string"}},"required":["employeeId","date"]},"AttendanceSummaryResponse":{"type":"object","properties":{"month":{"type":"string"},"rows":{"type":"array","items":{"type":"object","properties":{"employeeId":{"type":"string"},"employeeName":{"type":"string"},"present":{"type":"number"},"absent":{"type":"number"},"leave":{"type":"number"},"holiday":{"type":"number"},"rest":{"type":"number"},"hoursWorked":{"type":"number"}},"required":["employeeId","present","absent","leave","holiday","rest","hoursWorked"]}}},"required":["month","rows"]},"ExpenseClaimResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"employeeId":{"type":"string"},"employeeName":{"type":"string"},"title":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string"},"accountCode":{"type":"string"},"amountCents":{"type":"integer"}},"required":["description","accountCode","amountCents"]}},"totalCents":{"type":"integer"},"status":{"type":"string","enum":["submitted","approved","rejected","reimbursed"]},"journalEntryId":{"type":"string"}},"required":["id","number","employeeId","lines","totalCents","status"]},"ExpenseClaimsResponse":{"type":"object","properties":{"claims":{"type":"array","items":{"$ref":"#/components/schemas/ExpenseClaimResponse"}}},"required":["claims"]},"SubmitClaimRequest":{"type":"object","properties":{"employeeId":{"type":"string","minLength":1},"title":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"accountCode":{"type":"string"},"amountCents":{"type":"integer","exclusiveMinimum":0}},"required":["description","amountCents"]},"minItems":1}},"required":["employeeId","lines"]},"DecideClaimRequest":{"type":"object","properties":{"decision":{"type":"string","enum":["approved","rejected"]}},"required":["decision"]},"WorkforceInsightsResponse":{"type":"object","properties":{"headcount":{"type":"number"},"highRisk":{"type":"number"},"moderateRisk":{"type":"number"},"averageRisk":{"type":"number"},"employees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"riskScore":{"type":"number"},"band":{"type":"string","enum":["low","moderate","high"]},"factors":{"type":"array","items":{"type":"string"}},"recommendation":{"type":"string"}},"required":["id","name","riskScore","band","factors","recommendation"]}}},"required":["headcount","highRisk","moderateRisk","averageRisk","employees"]},"LandedCostVoucherResponse":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"locationId":{"type":"string"},"description":{"type":"string"},"totalCostCents":{"type":"integer"},"basis":{"type":"string","enum":["quantity","value"]},"allocations":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"sku":{"type":"string"},"allocatedCents":{"type":"integer"},"newAvgCostCents":{"type":"integer"}},"required":["productId","allocatedCents","newAvgCostCents"]}}},"required":["id","number","locationId","description","totalCostCents","basis","allocations"]},"LandedCostVouchersResponse":{"type":"object","properties":{"vouchers":{"type":"array","items":{"$ref":"#/components/schemas/LandedCostVoucherResponse"}}},"required":["vouchers"]},"ApplyLandedCostRequest":{"type":"object","properties":{"locationId":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"amountCents":{"type":"integer","exclusiveMinimum":0},"basis":{"type":"string","enum":["quantity","value"]}},"required":["locationId","description","amountCents"]}},"parameters":{}},"paths":{"/api/health":{"get":{"tags":["Platform"],"summary":"Service & database health","responses":{"200":{"description":"Healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/api/auth/login":{"post":{"tags":["Auth"],"summary":"Authenticate within the current tenant; sets a session cookie","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}}},"responses":{"200":{"description":"Authenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"401":{"description":"Invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/auth/me":{"get":{"tags":["Auth"],"summary":"Current session user with resolved permissions","responses":{"200":{"description":"Session user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionUser"}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/auth/logout":{"post":{"tags":["Auth"],"summary":"Clear the session cookie","responses":{"204":{"description":"Logged out"}}}},"/api/config":{"get":{"tags":["Config"],"summary":"Tenant config: plan, branding, and effective feature flags","responses":{"200":{"description":"Config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantConfigResponse"}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/config/flags":{"patch":{"tags":["Config"],"summary":"Set per-tenant feature-flag overrides (requires config.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateFlagsRequest"}}}},"responses":{"200":{"description":"Updated config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantConfigResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/config/branding":{"patch":{"tags":["Config"],"summary":"Update tenant branding (requires config.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBrandingRequest"}}}},"responses":{"200":{"description":"Updated config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantConfigResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/ai/documents":{"post":{"tags":["AI"],"summary":"Ingest a document into the tenant's RAG corpus","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestRequest"}}}},"responses":{"201":{"description":"Ingested","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResponse"}}}},"403":{"description":"Feature disabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/ai/ask":{"post":{"tags":["AI"],"summary":"RAG-grounded NL query; returns answer + confidence + a pending suggestion","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AskRequest"}}}},"responses":{"200":{"description":"Answer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AskResponse"}}}},"403":{"description":"Feature disabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/ai/extract":{"post":{"tags":["AI"],"summary":"Document AI: extract a supplier invoice/receipt into a draft (Document AI feature)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractRequest"}}}},"responses":{"201":{"description":"Draft extraction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionResponse"}}}},"403":{"description":"Feature disabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/ai/extractions":{"get":{"tags":["AI"],"summary":"List document extractions","responses":{"200":{"description":"Extractions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionsResponse"}}}}}}},"/api/ai/extractions/{id}/approve":{"post":{"tags":["AI"],"summary":"Approve a draft into a posted AP bill (human-in-the-loop)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveExtractionRequest"}}}},"responses":{"200":{"description":"Approved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/ai/usage":{"get":{"tags":["AI"],"summary":"AI usage metering summary for the current tenant","responses":{"200":{"description":"Usage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"}}}}}}},"/api/ai/suggestions/{id}/decision":{"post":{"tags":["AI"],"summary":"Human-in-the-loop: approve / reject / edit an AI suggestion","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionRequest"}}}},"responses":{"200":{"description":"Updated suggestion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuggestionResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/billing/plans":{"get":{"tags":["Billing"],"summary":"Available subscription plans","responses":{"200":{"description":"Plans","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlansResponse"}}}}}}},"/api/billing/subscription":{"get":{"tags":["Billing"],"summary":"Current tenant subscription","responses":{"200":{"description":"Subscription","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"404":{"description":"No subscription","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/billing/subscribe":{"post":{"tags":["Billing"],"summary":"Start a subscription (begins a trial); sets the tenant plan","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscribeRequest"}}}},"responses":{"201":{"description":"Subscribed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/billing/change-plan":{"post":{"tags":["Billing"],"summary":"Change plan with proration; updates plan gating","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePlanRequest"}}}},"responses":{"200":{"description":"Updated subscription","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/billing/invoices/generate":{"post":{"tags":["Billing"],"summary":"Generate the current invoice (base + seats + metered AI overage)","responses":{"201":{"description":"Invoice","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceResponse"}}}}}}},"/api/billing/invoices":{"get":{"tags":["Billing"],"summary":"List billing invoices","responses":{"200":{"description":"Invoices","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoicesResponse"}}}}}}},"/api/billing/invoices/{id}/pay":{"post":{"tags":["Billing"],"summary":"Pay an invoice via the configured payment gateway","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Paid invoice","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/billing/ai-usage":{"get":{"tags":["Billing"],"summary":"Current-period AI token usage vs quota + projected metered overage","responses":{"200":{"description":"AI usage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiUsageResponse"}}}}}}},"/api/billing/summary":{"get":{"tags":["Billing"],"summary":"Account billing summary: MRR/ARR, billed/paid/outstanding, overdue count","responses":{"200":{"description":"Summary","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingSummaryResponse"}}}}}}},"/api/billing/dunning/run":{"post":{"tags":["Billing"],"summary":"Run dunning on overdue subscription invoices; escalates to past_due (billing.manage)","responses":{"200":{"description":"Dunning result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DunningResultResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/billing/operator-revenue":{"get":{"tags":["Billing"],"summary":"Operator (platform) revenue rollup across all tenants: MRR/ARR + billed/paid/outstanding (billing.manage)","responses":{"200":{"description":"Rollup","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperatorRevenueResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/accounts":{"get":{"tags":["Finance"],"summary":"List chart of accounts","responses":{"200":{"description":"Accounts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountsResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Create an account (requires finance.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccountRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/accounts/seed-standard":{"post":{"tags":["Finance"],"summary":"Seed the standard chart of accounts (requires finance.manage)","responses":{"200":{"description":"Seeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountsResponse"}}}}}}},"/api/finance/journals":{"get":{"tags":["Finance"],"summary":"List journal entries","responses":{"200":{"description":"Journals","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalsResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Post a balanced double-entry journal (requires finance.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostJournalRequest"}}}},"responses":{"201":{"description":"Posted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalResponse"}}}},"400":{"description":"Unbalanced/invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/trial-balance":{"get":{"tags":["Finance"],"summary":"Trial balance from posted entries","responses":{"200":{"description":"Trial balance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrialBalanceResponse"}}}}}}},"/api/finance/recurring":{"get":{"tags":["Finance"],"summary":"List recurring invoice templates (retainers / subscriptions)","responses":{"200":{"description":"Recurring","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecurringInvoicesResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Create a recurring invoice template (finance.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRecurringRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecurringInvoiceResponse"}}}}}}},"/api/finance/recurring/{id}":{"patch":{"tags":["Finance"],"summary":"Pause/resume a recurring template (finance.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRecurringRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecurringInvoiceResponse"}}}}}},"delete":{"tags":["Finance"],"summary":"Delete a recurring template (finance.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted"}}}},"/api/finance/recurring/{id}/run":{"post":{"tags":["Finance"],"summary":"Generate an invoice from a template now & advance its schedule (finance.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"AR invoice","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArInvoiceResponse"}}}}}}},"/api/finance/recurring/run-due":{"post":{"tags":["Finance"],"summary":"Generate invoices for all templates due now (finance.manage; also the worker cron entry)","responses":{"200":{"description":"Run result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunDueResponse"}}}}}}},"/api/finance/anomalies":{"get":{"tags":["Finance"],"summary":"Finance AI: anomaly/fraud detection over posted journals (explainable scores)","responses":{"200":{"description":"Anomalies","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnomaliesResponse"}}}}}}},"/api/finance/fx":{"get":{"tags":["Finance"],"summary":"List configured exchange rates (to base currency)","responses":{"200":{"description":"Rates","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeRatesResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Set an exchange rate (finance.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetExchangeRateRequest"}}}},"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeRateResponse"}}}}}}},"/api/finance/entities":{"get":{"tags":["Finance"],"summary":"List reporting entities in the tenant group (auto-creates a primary)","responses":{"200":{"description":"Entities","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntitiesResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Create a reporting entity (finance.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEntityRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntityResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/consolidation":{"get":{"tags":["Finance"],"summary":"Consolidated trial balance: accounts × entities + total, with eliminations netted (?from&to)","responses":{"200":{"description":"Consolidation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsolidationResponse"}}}}}}},"/api/finance/interco":{"get":{"tags":["Finance"],"summary":"Inter-company match position: IC receivable/payable per entity + eliminable/unmatched residual","responses":{"200":{"description":"Match","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InterCoMatchResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Auto-eliminate the matched inter-company balance to the elimination entity (finance.manage)","responses":{"200":{"description":"Eliminated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InterCoEliminateResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/interco/transactions":{"get":{"tags":["Finance"],"summary":"Suggest transaction-level inter-company matches (reciprocal document pairs)","responses":{"200":{"description":"Pairs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IcTransactionPairsResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Match & eliminate inter-company transactions per pair, or post a new IC transaction (finance.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostInterCoTxnRequest"}}}},"responses":{"200":{"description":"Match result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IcMatchResultResponse"}}}},"201":{"description":"IC transaction posted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InterCoEliminateResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/revaluation":{"get":{"tags":["Finance"],"summary":"Preview unrealized FX gain/loss on open foreign-currency receivables at current rates","responses":{"200":{"description":"Preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevaluationPreviewResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Post the unrealized FX revaluation of open receivables (finance.manage)","responses":{"200":{"description":"Posted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevaluationResultResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/revaluation/runs":{"get":{"tags":["Finance"],"summary":"List posted FX revaluation runs (reversible at period open)","responses":{"200":{"description":"Runs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevaluationRunsResponse"}}}}}}},"/api/finance/revaluation/runs/{id}/reverse":{"post":{"tags":["Finance"],"summary":"Reverse a revaluation run at period open (finance.manage)","responses":{"200":{"description":"Reversed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevaluationReversalResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/compliance/sst-report":{"get":{"tags":["Compliance"],"summary":"SST report: taxable sales + SST collected (?from&to)","responses":{"200":{"description":"SST report","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SstReportResponse"}}}}}}},"/api/compliance/gst-f5":{"get":{"tags":["Compliance"],"summary":"Singapore GST F5 return: output tax, taxable supplies/purchases, input tax, net GST (?from&to)","responses":{"200":{"description":"GST F5","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GstF5Response"}}}}}}},"/api/compliance/ir8a":{"get":{"tags":["Compliance"],"summary":"Singapore IRAS IR8A annual return: per-employee remuneration + CPF (?year=YYYY)","responses":{"200":{"description":"IR8A","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ir8aResponse"}}}}}}},"/api/compliance/tax-settings":{"patch":{"tags":["Compliance"],"summary":"Set tax identifiers (TIN, SST reg no) (finance.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxSettingsRequest"}}}},"responses":{"200":{"description":"Saved"}}}},"/api/compliance/einvoices":{"get":{"tags":["Compliance"],"summary":"List MyInvois e-invoices","responses":{"200":{"description":"E-invoices","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EInvoicesResponse"}}}}}}},"/api/compliance/einvoices/{arInvoiceId}":{"post":{"tags":["Compliance"],"summary":"Generate, validate & submit a MyInvois e-invoice for an AR invoice (finance.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"arInvoiceId","in":"path"}],"responses":{"200":{"description":"E-invoice","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EInvoiceResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/approvals":{"get":{"tags":["Approvals"],"summary":"List approval requests (?status)","responses":{"200":{"description":"Approvals","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalsResponse"}}}}}},"post":{"tags":["Approvals"],"summary":"Submit an approval request","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApprovalRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalResponse"}}}}}}},"/api/approvals/{id}/decision":{"post":{"tags":["Approvals"],"summary":"Approve or reject a request (approvals.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecideApprovalRequest"}}}},"responses":{"200":{"description":"Decided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/bank/transactions":{"get":{"tags":["Finance"],"summary":"GL bank-account movements with reconciled flag (?bankCode)","responses":{"200":{"description":"Transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankTxnsResponse"}}}}}}},"/api/finance/bank/statement-lines":{"get":{"tags":["Finance"],"summary":"Imported bank statement lines (?bankCode)","responses":{"200":{"description":"Lines","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatementLinesResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Import bank statement lines (finance.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportStatementRequest"}}}},"responses":{"201":{"description":"Imported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatementLinesResponse"}}}}}}},"/api/finance/bank/auto-match":{"post":{"tags":["Finance"],"summary":"Auto-match statement lines to ledger by amount (finance.manage)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"bankCode":{"type":"string"}}}}}},"responses":{"200":{"description":"Matched","content":{"application/json":{"schema":{"type":"object","properties":{"matched":{"type":"number"}},"required":["matched"]}}}}}}},"/api/finance/bank/match":{"post":{"tags":["Finance"],"summary":"Manually match a statement line to a ledger entry (finance.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchRequest"}}}},"responses":{"200":{"description":"Matched"},"400":{"description":"Amount mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/bank/summary":{"get":{"tags":["Finance"],"summary":"Reconciliation summary incl. match rate (?bankCode&statementBalance)","responses":{"200":{"description":"Summary","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReconSummaryResponse"}}}}}}},"/api/finance/bank/suggestions":{"get":{"tags":["Finance"],"summary":"Auto-reconciliation suggestions: best ledger match per unreconciled statement line (?bankCode)","responses":{"200":{"description":"Suggestions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchSuggestionsResponse"}}}}}}},"/api/finance/reports/profit-loss":{"get":{"tags":["Finance"],"summary":"Profit & loss for a period (?from&to ISO dates)","responses":{"200":{"description":"P&L","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfitLossResponse"}}}}}}},"/api/finance/reports/balance-sheet":{"get":{"tags":["Finance"],"summary":"Balance sheet as of a date (?asOf ISO date)","responses":{"200":{"description":"Balance sheet","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BalanceSheetResponse"}}}}}}},"/api/finance/reports/cash-flow":{"get":{"tags":["Finance"],"summary":"Cash flow for a period (?from&to ISO dates)","responses":{"200":{"description":"Cash flow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CashFlowResponse"}}}}}}},"/api/finance/customers":{"get":{"tags":["Finance"],"summary":"List customers","responses":{"200":{"description":"Customers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomersResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Create a customer (finance.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomerRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResponse"}}}}}}},"/api/finance/suppliers":{"get":{"tags":["Finance"],"summary":"List suppliers","responses":{"200":{"description":"Suppliers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuppliersResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Create a supplier (finance.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSupplierRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierResponse"}}}}}}},"/api/finance/ar-invoices":{"get":{"tags":["Finance"],"summary":"List customer invoices","responses":{"200":{"description":"Invoices","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArInvoicesResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Post a customer invoice (Dr A/R, Cr income) — finance.manage","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostArInvoiceRequest"}}}},"responses":{"201":{"description":"Posted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArInvoiceResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/ar-invoices/{id}/pay":{"post":{"tags":["Finance"],"summary":"Record a customer payment (Dr Bank, Cr A/R) — finance.manage","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequest"}}}},"responses":{"200":{"description":"Updated invoice","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArInvoiceResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/ap-bills":{"get":{"tags":["Finance"],"summary":"List supplier bills","responses":{"200":{"description":"Bills","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApBillsResponse"}}}}}},"post":{"tags":["Finance"],"summary":"Post a supplier bill (Dr expense/asset, Cr A/P) — finance.manage","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostApBillRequest"}}}},"responses":{"201":{"description":"Posted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApBillResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/ap-bills/{id}/pay":{"post":{"tags":["Finance"],"summary":"Record a supplier payment (Dr A/P, Cr Bank) — finance.manage","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequest"}}}},"responses":{"200":{"description":"Updated bill","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApBillResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/retail/members":{"get":{"tags":["Retail"],"summary":"List loyalty members","responses":{"200":{"description":"Members","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MembersResponse"}}}}}},"post":{"tags":["Retail"],"summary":"Create a loyalty member (pos.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMemberRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberResponse"}}}}}}},"/api/retail/pos":{"get":{"tags":["Retail"],"summary":"List POS orders","responses":{"200":{"description":"Orders","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PosOrdersResponse"}}}}}},"post":{"tags":["Retail"],"summary":"Ring up a POS sale (posts GL, reduces stock, awards points) (pos.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PosCheckoutRequest"}}}},"responses":{"201":{"description":"Sold","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PosOrderResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/inventory/locations":{"get":{"tags":["Inventory"],"summary":"List stock locations","responses":{"200":{"description":"Locations","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationsResponse"}}}}}},"post":{"tags":["Inventory"],"summary":"Create a location (inventory.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLocationRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationResponse"}}}}}}},"/api/inventory/levels":{"get":{"tags":["Inventory"],"summary":"Stock on hand + valuation (weighted average)","responses":{"200":{"description":"Levels","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLevelsResponse"}}}}}}},"/api/inventory/receipts":{"post":{"tags":["Inventory"],"summary":"Record a stock receipt (inventory.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptRequest"}}}},"responses":{"201":{"description":"Recorded"},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/inventory/issues":{"post":{"tags":["Inventory"],"summary":"Issue stock (inventory.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueRequest"}}}},"responses":{"201":{"description":"Issued"},"400":{"description":"Insufficient/invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/inventory/transfers":{"post":{"tags":["Inventory"],"summary":"Transfer stock between locations (inventory.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferRequest"}}}},"responses":{"201":{"description":"Transferred"},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/inventory/stock-takes":{"post":{"tags":["Inventory"],"summary":"Adjust on-hand to a counted quantity (inventory.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockTakeRequest"}}}},"responses":{"200":{"description":"Adjusted"}}}},"/api/inventory/lookup":{"get":{"tags":["Inventory"],"summary":"Look up an item by barcode or SKU (?q=)","responses":{"200":{"description":"Item","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemLookupResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/purchasing/requisitions":{"get":{"tags":["Purchasing"],"summary":"List purchase requisitions","responses":{"200":{"description":"Requisitions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequisitionsResponse"}}}}}},"post":{"tags":["Purchasing"],"summary":"Create a purchase requisition (purchasing.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRequisitionRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequisitionResponse"}}}}}}},"/api/purchasing/requisitions/{id}/approve":{"post":{"tags":["Purchasing"],"summary":"Approve a requisition (purchasing.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Approved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequisitionResponse"}}}}}}},"/api/purchasing/purchase-orders":{"get":{"tags":["Purchasing"],"summary":"List purchase orders","responses":{"200":{"description":"POs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrdersResponse"}}}}}},"post":{"tags":["Purchasing"],"summary":"Create a purchase order, optionally from a requisition (purchasing.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePurchaseOrderRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderResponse"}}}}}}},"/api/purchasing/purchase-orders/{id}/receive":{"post":{"tags":["Purchasing"],"summary":"Receive goods against a PO (creates a GRN) (purchasing.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiveGoodsRequest"}}}},"responses":{"201":{"description":"Received","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoodsReceiptResponse"}}}}}}},"/api/purchasing/purchase-orders/{id}/bill":{"post":{"tags":["Purchasing"],"summary":"3-way match and bill a PO -> posts an AP bill (purchasing.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Billed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderResponse"}}}},"400":{"description":"3-way match failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/purchasing/goods-receipts":{"get":{"tags":["Purchasing"],"summary":"List goods receipts","responses":{"200":{"description":"GRNs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoodsReceiptsResponse"}}}}}}},"/api/sales/products":{"get":{"tags":["Sales"],"summary":"List products","responses":{"200":{"description":"Products","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductsResponse"}}}}}},"post":{"tags":["Sales"],"summary":"Create a product (sales.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProductRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponse"}}}}}}},"/api/sales/quotations":{"get":{"tags":["Sales"],"summary":"List quotations","responses":{"200":{"description":"Quotations","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuotationsResponse"}}}}}},"post":{"tags":["Sales"],"summary":"Create a quotation (sales.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateQuotationRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesDocResponse"}}}}}}},"/api/sales/sales-orders":{"get":{"tags":["Sales"],"summary":"List sales orders","responses":{"200":{"description":"Sales orders","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesOrdersResponse"}}}}}},"post":{"tags":["Sales"],"summary":"Create a sales order, optionally from a quotation (sales.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSalesOrderRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesDocResponse"}}}}}}},"/api/sales/sales-orders/{id}/invoice":{"post":{"tags":["Sales"],"summary":"Convert a sales order to a posted AR invoice (sales.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Invoiced","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesDocResponse"}}}}}}},"/api/sales/sales-orders/{id}/deliver":{"post":{"tags":["Sales"],"summary":"Create a delivery order from a sales order (sales.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"201":{"description":"Delivered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryOrderResponse"}}}}}}},"/api/sales/delivery-orders":{"get":{"tags":["Sales"],"summary":"List delivery orders","responses":{"200":{"description":"Delivery orders","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryOrdersResponse"}}}}}}},"/api/sales/insights":{"get":{"tags":["Sales"],"summary":"AI CRM: customer RFM scoring + next-best-action","responses":{"200":{"description":"Insights","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerInsightsResponse"}}}}}}},"/api/sales/notes":{"get":{"tags":["Sales"],"summary":"Customer notes/interactions with sentiment (?customerId)","responses":{"200":{"description":"Notes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerNotesResponse"}}}}}},"post":{"tags":["Sales"],"summary":"Log a customer note; sentiment is auto-analysed (sales.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddCustomerNoteRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerNoteResponse"}}}}}}},"/api/users":{"get":{"tags":["Tenancy"],"summary":"List users in the current tenant (requires user.read)","responses":{"200":{"description":"Users","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsersResponse"}}}},"401":{"description":"Not authenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tenants/signup":{"post":{"tags":["Tenancy"],"summary":"Self-serve tenant signup & auto-provisioning","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupRequest"}}}},"responses":{"201":{"description":"Tenant provisioned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Slug already taken","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tenant/export":{"get":{"tags":["Tenancy"],"summary":"Export all of the current tenant's data as a portable JSON snapshot (tenant.manage / owner)","responses":{"200":{"description":"Full export","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantExportResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tenant/offboard":{"post":{"tags":["Tenancy"],"summary":"Offboard (close) the current tenant — terminal; optionally purge all data (tenant.manage / owner)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OffboardTenantRequest"}}}},"responses":{"200":{"description":"Offboarded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OffboardTenantResponse"}}}},"400":{"description":"Confirmation required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/reports/sources":{"get":{"tags":["Reports"],"summary":"List report sources with their available dimensions + measures","responses":{"200":{"description":"Sources","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportSourcesResponse"}}}}}}},"/api/reports/run":{"post":{"tags":["Reports"],"summary":"Run an ad-hoc report from a spec (reports.read)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportSpecRequest"}}}},"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportResultResponse"}}}},"400":{"description":"Invalid spec","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/reports":{"get":{"tags":["Reports"],"summary":"List saved report definitions","responses":{"200":{"description":"Reports","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportDefinitionsResponse"}}}}}},"post":{"tags":["Reports"],"summary":"Save a report definition (reports.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateReportRequest"}}}},"responses":{"201":{"description":"Saved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportDefinitionResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/reports/{id}/run":{"get":{"tags":["Reports"],"summary":"Run a saved report (reports.read)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportResultResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/reports/{id}":{"delete":{"tags":["Reports"],"summary":"Delete a saved report (reports.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/reports/{id}/schedule":{"post":{"tags":["Reports"],"summary":"Set a saved report's schedule; the worker sweep runs due reports (reports.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetReportScheduleRequest"}}}},"responses":{"200":{"description":"Scheduled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportDefinitionResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/reports/snapshots":{"get":{"tags":["Reports"],"summary":"List materialised scheduled-report snapshots (?reportId)","responses":{"200":{"description":"Snapshots","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportSnapshotsResponse"}}}}}}},"/api/reports/export":{"post":{"tags":["Reports"],"summary":"Run an ad-hoc report and export it as CSV or a letterheaded PDF (reports.read)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportReportRequest"}}}},"responses":{"200":{"description":"CSV (text/csv) or PDF (application/pdf) file download"},"400":{"description":"Invalid spec","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/reports/{id}/export":{"get":{"tags":["Reports"],"summary":"Export a saved report as CSV or a letterheaded PDF (?format=csv|pdf) (reports.read)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"CSV (text/csv) or PDF (application/pdf) file download"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/integrations/webhooks":{"get":{"tags":["Integrations"],"summary":"List webhook subscriptions + the catalogue of emittable events","responses":{"200":{"description":"Webhooks","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhooksResponse"}}}}}},"post":{"tags":["Integrations"],"summary":"Create a webhook subscription (integrations.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhookRequest"}}}},"responses":{"201":{"description":"Created (returns the signing secret once)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/integrations/webhooks/{id}":{"patch":{"tags":["Integrations"],"summary":"Enable/disable a webhook subscription (integrations.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWebhookRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookResponse"}}}}}},"delete":{"tags":["Integrations"],"summary":"Delete a webhook subscription (integrations.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/integrations/webhooks/{id}/ping":{"post":{"tags":["Integrations"],"summary":"Send a synthetic ping event to test connectivity (integrations.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Ping delivery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveryResponse"}}}}}}},"/api/integrations/webhooks/deliveries":{"get":{"tags":["Integrations"],"summary":"Recent webhook delivery attempts","responses":{"200":{"description":"Deliveries","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveriesResponse"}}}}}}},"/api/integrations/webhooks/deliveries/{id}/redeliver":{"post":{"tags":["Integrations"],"summary":"Re-attempt a delivery (integrations.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Redelivered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveryResponse"}}}}}}},"/api/dashboard/widgets":{"get":{"tags":["Dashboard"],"summary":"Catalogue of widgets the current user is permitted to see","responses":{"200":{"description":"Widgets","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardWidgetsResponse"}}}}}}},"/api/dashboard/layout":{"get":{"tags":["Dashboard"],"summary":"The current user's saved dashboard layout (or a default), filtered to permitted widgets","responses":{"200":{"description":"Layout","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardLayoutResponse"}}}}}},"put":{"tags":["Dashboard"],"summary":"Save the current user's dashboard layout (widget keys, sizes, order)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveDashboardLayoutRequest"}}}},"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardLayoutResponse"}}}}}}},"/api/dashboard/data":{"get":{"tags":["Dashboard"],"summary":"Resolve live data for widget keys (?keys=a,b,c), enforcing RBAC per widget","responses":{"200":{"description":"Widget data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardDataResponse"}}}}}}},"/api/marketplace/apps":{"get":{"tags":["Marketplace"],"summary":"Marketplace app catalogue","responses":{"200":{"description":"Catalogue","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketplaceCatalogResponse"}}}}}}},"/api/marketplace/installations":{"get":{"tags":["Marketplace"],"summary":"Apps installed in the current tenant","responses":{"200":{"description":"Installations","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppInstallationsResponse"}}}}}},"post":{"tags":["Marketplace"],"summary":"Install an app (integrations.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstallAppRequest"}}}},"responses":{"201":{"description":"Installed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppInstallationResponse"}}}},"400":{"description":"Unknown app","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/marketplace/installations/{appKey}":{"patch":{"tags":["Marketplace"],"summary":"Enable/disable an installed app (integrations.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"appKey","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAppRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppInstallationResponse"}}}}}},"delete":{"tags":["Marketplace"],"summary":"Uninstall an app (integrations.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"appKey","in":"path"}],"responses":{"200":{"description":"Uninstalled"},"400":{"description":"Not installed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/marketplace/developer-apps":{"get":{"tags":["Marketplace"],"summary":"List registered partner/developer apps (integrations.manage)","responses":{"200":{"description":"Apps","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperAppsResponse"}}}}}},"post":{"tags":["Marketplace"],"summary":"Register a developer app; returns the one-time client secret (integrations.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterDeveloperAppRequest"}}}},"responses":{"201":{"description":"Registered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperAppResponse"}}}}}}},"/api/marketplace/developer-apps/{id}/rotate":{"post":{"tags":["Marketplace"],"summary":"Rotate a developer app's secret; returns the new one-time secret (integrations.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Rotated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperAppResponse"}}}}}}},"/api/marketplace/developer-apps/{id}":{"delete":{"tags":["Marketplace"],"summary":"Revoke a developer app (integrations.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperAppResponse"}}}}}}},"/api/marketplace/revenue-share":{"get":{"tags":["Marketplace"],"summary":"Partner revenue-share report across all tenants (operator view) (integrations.manage)","responses":{"200":{"description":"Rev-share","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevShareResponse"}}}}}}},"/api/oauth/token":{"post":{"tags":["Marketplace"],"summary":"OAuth2 client-credentials grant — exchange a developer app's clientId/secret for a scoped access token","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthTokenRequest"}}}},"responses":{"200":{"description":"Access token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthTokenResponse"}}}},"401":{"description":"Invalid client credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/localisation/profiles":{"get":{"tags":["Localisation"],"summary":"All supported regional profiles (tax system, codes/rates, currency, e-invoice format)","responses":{"200":{"description":"Profiles","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocalisationProfilesResponse"}}}}}}},"/api/localisation/active":{"get":{"tags":["Localisation"],"summary":"The active localisation profile for the current tenant's region","responses":{"200":{"description":"Active profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActiveLocalisationResponse"}}}}}}},"/api/projects":{"get":{"tags":["Projects"],"summary":"List projects/jobs","responses":{"200":{"description":"Projects","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectsResponse"}}}}}},"post":{"tags":["Projects"],"summary":"Create a project (projects.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectResponse"}}}}}}},"/api/projects/{id}":{"get":{"tags":["Projects"],"summary":"Project detail: project + time entries + cost summary","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Project detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectDetailResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/projects/{id}/time":{"post":{"tags":["Projects"],"summary":"Log a timesheet entry against a project (projects.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogTimeRequest"}}}},"responses":{"201":{"description":"Logged","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectDetailResponse"}}}}}}},"/api/projects/{id}/bill":{"post":{"tags":["Projects"],"summary":"Bill unbilled billable time + expenses as a posted AR invoice (projects.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"AR invoice","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArInvoiceResponse"}}}},"400":{"description":"Nothing to bill","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/projects/{id}/milestones":{"post":{"tags":["Projects"],"summary":"Add a fixed-fee milestone to a project (projects.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddMilestoneRequest"}}}},"responses":{"201":{"description":"Added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MilestoneResponse"}}}}}}},"/api/projects/milestones/{id}/bill":{"post":{"tags":["Projects"],"summary":"Bill a fixed-fee milestone as a posted AR invoice (projects.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"AR invoice","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArInvoiceResponse"}}}},"400":{"description":"Already billed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/projects/{id}/expenses":{"post":{"tags":["Projects"],"summary":"Record a project cost/expense (optionally billable) (projects.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordProjectExpenseRequest"}}}},"responses":{"201":{"description":"Recorded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectExpenseResponse"}}}}}}},"/api/wms/bins":{"get":{"tags":["Warehouse"],"summary":"List storage bins (?locationId)","responses":{"200":{"description":"Bins","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BinsResponse"}}}}}},"post":{"tags":["Warehouse"],"summary":"Create a storage bin (wms.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBinRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BinResponse"}}}}}}},"/api/wms/bin-stock":{"get":{"tags":["Warehouse"],"summary":"Bin-level on-hand quantities (?productId&locationId&binCode)","responses":{"200":{"description":"Bin stock","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BinStockListResponse"}}}}}}},"/api/wms/bin-stock/putaway":{"post":{"tags":["Warehouse"],"summary":"Put away unbinned floor stock into a bin (wms.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PutawayRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BinStockListResponse"}}}},"400":{"description":"Exceeds on-hand","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/wms/bin-stock/move":{"post":{"tags":["Warehouse"],"summary":"Relocate stock between bins at a location (wms.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveBinRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BinStockListResponse"}}}},"400":{"description":"Invalid move","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/wms/waves":{"get":{"tags":["Warehouse"],"summary":"List pick waves (batch picking)","responses":{"200":{"description":"Waves","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WavesResponse"}}}}}},"post":{"tags":["Warehouse"],"summary":"Create a pick wave from open fulfillments at one location (wms.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWaveRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaveResponse"}}}},"400":{"description":"Invalid selection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/wms/waves/{id}/complete":{"post":{"tags":["Warehouse"],"summary":"Complete a wave: pack all member fulfillments (wms.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteWaveRequest"}}}},"responses":{"200":{"description":"Picked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaveResponse"}}}},"400":{"description":"Invalid state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/wms/routes":{"get":{"tags":["Warehouse"],"summary":"List van-sales route trips","responses":{"200":{"description":"Trips","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteTripsResponse"}}}}}},"post":{"tags":["Warehouse"],"summary":"Start a van route trip (van + source location) (wms.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRouteTripRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteTripResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/wms/routes/{id}/load":{"post":{"tags":["Warehouse"],"summary":"Load stock onto the van (transfer source → van) (wms.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoadVanRequest"}}}},"responses":{"200":{"description":"Loaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteTripResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/wms/routes/{id}/sale":{"post":{"tags":["Warehouse"],"summary":"Record a route sale (issue van stock + post cash/AR revenue) (wms.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteSaleRequest"}}}},"responses":{"200":{"description":"Sold","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteTripResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/wms/routes/{id}/settle":{"post":{"tags":["Warehouse"],"summary":"Settle a route trip: return unsold van stock to source (wms.manage)","responses":{"200":{"description":"Settled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettleRouteResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/wms/fulfillments":{"get":{"tags":["Warehouse"],"summary":"List fulfillments (pick/pack/ship)","responses":{"200":{"description":"Fulfillments","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FulfillmentsResponse"}}}}}},"post":{"tags":["Warehouse"],"summary":"Create a fulfillment (pick list) from a sales order (wms.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFulfillmentRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FulfillmentResponse"}}}},"400":{"description":"Invalid / no stock lines","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/wms/fulfillments/{id}/pack":{"post":{"tags":["Warehouse"],"summary":"Mark picked & packed, assigning pick bins (wms.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackFulfillmentRequest"}}}},"responses":{"200":{"description":"Packed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FulfillmentResponse"}}}}}}},"/api/wms/fulfillments/{id}/ship":{"post":{"tags":["Warehouse"],"summary":"Ship a fulfillment: reduce stock + record carrier/tracking (wms.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShipFulfillmentRequest"}}}},"responses":{"200":{"description":"Shipped","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FulfillmentResponse"}}}},"400":{"description":"Already shipped / cancelled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/inventory/reorder":{"get":{"tags":["Planning"],"summary":"Reorder recommendations across tracked products (reorder point + suggested qty)","responses":{"200":{"description":"Recommendations","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderRecommendationsResponse"}}}}}}},"/api/inventory/forecast/{productId}":{"get":{"tags":["Planning"],"summary":"Monthly demand forecast for a product (moving-average / linear-trend, auto-selected)","parameters":[{"schema":{"type":"string"},"required":true,"name":"productId","in":"path"}],"responses":{"200":{"description":"Forecast","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemandForecastResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/manufacturing/boms":{"get":{"tags":["Manufacturing"],"summary":"List active bills of materials","responses":{"200":{"description":"BOMs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BomsResponse"}}}}}},"post":{"tags":["Manufacturing"],"summary":"Create a bill of materials (manufacturing.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBomRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BomResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/manufacturing/work-orders":{"get":{"tags":["Manufacturing"],"summary":"List work orders","responses":{"200":{"description":"Work orders","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkOrdersResponse"}}}}}},"post":{"tags":["Manufacturing"],"summary":"Open a work order from a BOM (manufacturing.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkOrderRequest"}}}},"responses":{"201":{"description":"Opened","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkOrderResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/manufacturing/work-orders/{id}/complete":{"post":{"tags":["Manufacturing"],"summary":"Complete a work order: consume components, produce finished goods, roll up cost, post conversion GL (manufacturing.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkOrderResponse"}}}},"400":{"description":"Insufficient stock / already completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/manufacturing/work-orders/{id}/qc":{"post":{"tags":["Manufacturing"],"summary":"Record a quality-control result for a work order (manufacturing.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkOrderQcRequest"}}}},"responses":{"200":{"description":"Recorded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkOrderResponse"}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/manufacturing/explode":{"get":{"tags":["Manufacturing"],"summary":"Multi-level BOM explosion to component requirements (?productId&qty)","responses":{"200":{"description":"Components","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExplodeResponse"}}}}}}},"/api/manufacturing/mrp":{"get":{"tags":["Manufacturing"],"summary":"MRP-lite: net component requirements vs on-hand (?productId&qty&locationId)","responses":{"200":{"description":"Requirements","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MrpResponse"}}}}}}},"/api/hr/employees":{"get":{"tags":["HR & Payroll"],"summary":"List employees (?includeTerminated)","responses":{"200":{"description":"Employees","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeesResponse"}}}}}},"post":{"tags":["HR & Payroll"],"summary":"Create an employee (hr.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEmployeeRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/hr/employees/{id}":{"patch":{"tags":["HR & Payroll"],"summary":"Update an employee; pass {status:'terminated'} to off-board (hr.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEmployeeRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/hr/leave":{"get":{"tags":["HR & Payroll"],"summary":"List leave requests (?status)","responses":{"200":{"description":"Leave","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeavesResponse"}}}}}},"post":{"tags":["HR & Payroll"],"summary":"Submit a leave request (hr.read)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestLeaveRequest"}}}},"responses":{"201":{"description":"Submitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveResponse"}}}}}}},"/api/hr/leave/{id}/decide":{"post":{"tags":["HR & Payroll"],"summary":"Approve or reject a leave request (hr.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecideLeaveRequest"}}}},"responses":{"200":{"description":"Decided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/payroll/runs":{"get":{"tags":["HR & Payroll"],"summary":"List payroll runs","responses":{"200":{"description":"Runs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayrollRunsResponse"}}}}}},"post":{"tags":["HR & Payroll"],"summary":"Create/refresh a draft payroll run for a period — computes EPF/SOCSO/EIS/PCB per active employee (payroll.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePayrollRunRequest"}}}},"responses":{"201":{"description":"Draft run","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayrollRunResponse"}}}},"400":{"description":"Invalid / no employees","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/payroll/runs/{id}":{"get":{"tags":["HR & Payroll"],"summary":"Get a payroll run with payslips","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Run","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayrollRunResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/payroll/runs/{id}/post":{"post":{"tags":["HR & Payroll"],"summary":"Post a draft payroll run to the GL (payroll.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Posted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayrollRunResponse"}}}},"400":{"description":"Already posted / invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/hr/attendance":{"get":{"tags":["HR & Payroll"],"summary":"List attendance records (?employeeId&month) or summary (?summary&month)","responses":{"200":{"description":"Attendance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendanceListResponse"}}}}}},"post":{"tags":["HR & Payroll"],"summary":"Record (upsert) a daily attendance entry (hr.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordAttendanceRequest"}}}},"responses":{"200":{"description":"Recorded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendanceResponse"}}}}}}},"/api/hr/attendance/summary":{"get":{"tags":["HR & Payroll"],"summary":"Monthly per-employee attendance summary (?month=YYYY-MM)","responses":{"200":{"description":"Summary","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendanceSummaryResponse"}}}}}}},"/api/hr/claims":{"get":{"tags":["HR & Payroll"],"summary":"List expense claims (?status)","responses":{"200":{"description":"Claims","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseClaimsResponse"}}}}}},"post":{"tags":["HR & Payroll"],"summary":"Submit an expense claim (hr.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitClaimRequest"}}}},"responses":{"201":{"description":"Submitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseClaimResponse"}}}}}}},"/api/hr/claims/{id}/decide":{"post":{"tags":["HR & Payroll"],"summary":"Approve or reject an expense claim (hr.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecideClaimRequest"}}}},"responses":{"200":{"description":"Decided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseClaimResponse"}}}}}}},"/api/hr/claims/{id}/reimburse":{"post":{"tags":["HR & Payroll"],"summary":"Reimburse an approved claim — posts Dr expense / Cr bank (hr.manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Reimbursed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseClaimResponse"}}}},"400":{"description":"Not approved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/hr/insights":{"get":{"tags":["HR & Payroll"],"summary":"AI HR — explainable attrition / flight-risk scoring across the workforce (hr.read)","responses":{"200":{"description":"Workforce insights","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkforceInsightsResponse"}}}}}}},"/api/finance/periods":{"get":{"tags":["Finance"],"summary":"List accounting periods and their open/closed status","responses":{"200":{"description":"Periods","content":{"application/json":{"schema":{"type":"object","properties":{"periods":{"type":"array","items":{"type":"object","properties":{"periodKey":{"type":"string","pattern":"^\\d{4}-\\d{2}$","example":"2026-06"},"status":{"type":"string","enum":["open","closed"]}},"required":["periodKey","status"]}}},"required":["periods"]}}}}}}},"/api/finance/periods/close":{"post":{"tags":["Finance"],"summary":"Close an accounting period; blocks further posting into it (finance.manage)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"periodKey":{"type":"string","pattern":"^\\d{4}-\\d{2}$","example":"2026-06"}},"required":["periodKey"]}}}},"responses":{"200":{"description":"Closed"},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/periods/reopen":{"post":{"tags":["Finance"],"summary":"Reopen a closed accounting period (finance.manage)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"periodKey":{"type":"string","pattern":"^\\d{4}-\\d{2}$","example":"2026-06"}},"required":["periodKey"]}}}},"responses":{"200":{"description":"Reopened"},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/inventory/landed-cost":{"get":{"tags":["Inventory"],"summary":"List landed-cost vouchers","responses":{"200":{"description":"Vouchers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LandedCostVouchersResponse"}}}}}},"post":{"tags":["Inventory"],"summary":"Capitalise a freight/duty cost into on-hand stock (allocate + raise avg cost + post GL) (inventory.manage)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyLandedCostRequest"}}}},"responses":{"201":{"description":"Applied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LandedCostVoucherResponse"}}}},"400":{"description":"No stock / invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/inventory/cost-method":{"get":{"tags":["Inventory"],"summary":"Get the active inventory cost method","responses":{"200":{"description":"Cost method","content":{"application/json":{"schema":{"type":"object","properties":{"costMethod":{"type":"string","enum":["weighted_average","fifo"]}},"required":["costMethod"]}}}}}},"patch":{"tags":["Inventory"],"summary":"Set the inventory cost method (inventory.manage)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"costMethod":{"type":"string","enum":["weighted_average","fifo"]}},"required":["costMethod"]}}}},"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"type":"object","properties":{"costMethod":{"type":"string","enum":["weighted_average","fifo"]}},"required":["costMethod"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/notifications":{"get":{"tags":["Notifications"],"summary":"List notifications for the current user with unread count","responses":{"200":{"description":"Notifications","content":{"application/json":{"schema":{"type":"object","properties":{"notifications":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"link":{"type":"string"},"read":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","kind","title","read","createdAt"]}},"unread":{"type":"integer"}},"required":["notifications","unread"]}}}}}}},"/api/notifications/{id}/read":{"post":{"tags":["Notifications"],"summary":"Mark a single notification as read","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Marked read"}}}},"/api/notifications/read-all":{"post":{"tags":["Notifications"],"summary":"Mark all of the current user's notifications as read","responses":{"200":{"description":"Marked all read"}}}},"/api/attachments":{"get":{"tags":["Documents"],"summary":"List attachments for an entity (?entity&entityId)","responses":{"200":{"description":"Attachments","content":{"application/json":{"schema":{"type":"object","properties":{"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"entity":{"type":"string"},"entityId":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer"},"createdAt":{"type":"string"}},"required":["id","entity","entityId","filename","contentType","size","createdAt"]}}},"required":["attachments"]}}}}}},"post":{"tags":["Documents"],"summary":"Upload an attachment (base64) linked to an entity","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"entity":{"type":"string"},"entityId":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"dataBase64":{"type":"string"}},"required":["entity","entityId","filename","contentType","dataBase64"]}}}},"responses":{"201":{"description":"Uploaded","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"entity":{"type":"string"},"entityId":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer"},"createdAt":{"type":"string"}},"required":["id","entity","entityId","filename","contentType","size","createdAt"]}}}},"400":{"description":"Invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/attachments/{id}/download":{"get":{"tags":["Documents"],"summary":"Download an attachment's binary content","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"File stream (Content-Type from attachment)"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/finance/ar-invoices/{id}/pdf":{"get":{"tags":["Documents"],"summary":"Render an AR invoice as a downloadable PDF","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"application/pdf invoice document"},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/retail/pos/sync":{"post":{"tags":["Retail"],"summary":"Sync a batch of offline POS orders (idempotent by clientRef) (pos.manage)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"orders":{"type":"array","items":{"type":"object","properties":{"clientRef":{"type":"string"},"memberId":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"quantity":{"type":"number"},"unitPriceCents":{"type":"integer"}},"required":["productId","quantity"]}}},"required":["clientRef","lines"]}}},"required":["orders"]}}}},"responses":{"200":{"description":"Sync result","content":{"application/json":{"schema":{"type":"object","properties":{"synced":{"type":"integer"},"skipped":{"type":"integer"}},"required":["synced","skipped"]}}}}}}},"/api/sales/marketplace":{"get":{"tags":["Sales"],"summary":"List imported marketplace orders","responses":{"200":{"description":"Marketplace orders","content":{"application/json":{"schema":{"type":"object","properties":{"orders":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"channel":{"type":"string","enum":["mock","shopee","lazada","woocommerce"]},"externalId":{"type":"string"},"buyerName":{"type":"string"},"totalCents":{"type":"integer"},"status":{"type":"string"}},"required":["id","channel","externalId","buyerName","totalCents","status"]}}},"required":["orders"]}}}}}}},"/api/sales/marketplace/import":{"post":{"tags":["Sales"],"summary":"Import orders from a marketplace channel as sales orders (idempotent) (sales.manage)","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"channel":{"type":"string","enum":["mock","shopee","lazada","woocommerce"],"default":"mock"}}}}}},"responses":{"200":{"description":"Import result","content":{"application/json":{"schema":{"type":"object","properties":{"imported":{"type":"integer"},"skipped":{"type":"integer"}},"required":["imported","skipped"]}}}}}}}},"webhooks":{}}