import { createGetDB, type Generated, type Timestamp, type NamespaceDB, type NamespaceInsertable, type NamespaceSelectable, type NamespaceTable, type NamespaceTableName, type NamespaceTransaction, type NamespaceUpdateable, } from "@tailor-platform/sdk/kysely"; export interface Namespace { "main-db": { AcquisitionCostAdjustment: { id: Generated; sourceType: "ACCOUNT_PAYABLE_DOCUMENT" | "PURCHASE_ORDER_REVISION" | "INVENTORY_LEDGER"; sourceId: string; sourceLineId: string | null; purchaseOrderId: string; purchaseOrderLineId: string; amount: string; kind: "INVOICE_PRICE" | "ORDER_PRICE" | "REDISTRIBUTION"; effectiveDate: Timestamp; createdAt: Generated; } AcquisitionCostAdjustmentAllocation: { id: Generated; acquisitionCostAdjustmentId: string; costLayerId: string; amount: string; varianceKind: "INVOICE_PRICE" | "ORDER_PRICE"; createdAt: Generated; } AverageCost: { id: Generated; itemId: string; companyId: string; sequence: number; eventType: "RECEIPT" | "ISSUE" | "COST_ADJUSTMENT"; quantityBefore: string; unitCostBefore: string; quantity: string; unitCost: string | null; quantityAfter: string; unitCostAfter: string; createdAt: Generated; } CostLayer: { id: Generated; itemId: string; companyId: string; ledgerEntryId: string; effectiveDate: Timestamp; quantity: string; remainingQuantity: string; createdAt: Generated; updatedAt: Generated; } CostLayerConsumption: { id: Generated; costLayerId: string; ledgerEntryId: string; quantity: string; createdAt: Generated; } FifoCost: { id: Generated; costLayerId: string; version: number; unitCost: string; createdAt: Generated; } InventoryLedger: { id: Generated; sourceType: "INBOUND_SHIPMENT" | "OUTBOUND_SHIPMENT" | "TRANSFER_ORDER" | "STOCK_ADJUSTMENT"; sourceId: string; sourceLineId: string | null; orderDocumentType: "PURCHASE_ORDER" | "SALES_ORDER" | "TRANSFER_ORDER" | null; orderDocumentId: string | null; orderDocumentLineId: string | null; direction: "IN" | "OUT"; action: "QUANTITY_CHANGE" | "TRANSFER" | "STOCK_TYPE_CHANGE"; itemId: string; storageLocationId: string; stockType: "AVAILABLE" | "BLOCKED" | "IN_TRANSIT"; quantity: string; executedAt: Timestamp; effectiveDate: Timestamp; createdAt: Generated; } InventorySupplyPlan: { id: Generated; sourceType: "PURCHASE_ORDER" | "TRANSFER_ORDER"; sourceId: string; sourceLineId: string; itemId: string; siteId: string; expectedQuantity: string; receivedQuantity: string; status: "OPEN" | "CLOSED"; expectedDate: Timestamp; createdAt: Generated; updatedAt: Generated; } ItemValuation: { id: Generated; itemId: string; companyId: string; valuationPolicyId: string; createdAt: Generated; updatedAt: Generated; } StandardCost: { id: Generated; itemId: string; version: number; unitCost: string; createdAt: Generated; } StockAdjustment: { id: Generated; adjustmentType: "CORRECTION" | "SCRAP" | "BLOCK" | "UNBLOCK"; status: "DRAFT" | "SUBMITTED" | "CANCELLED" | "CONFIRMED" | "REJECTED"; reasonCode: string; adjustmentDate: Timestamp; rejectionReason: string | null; createdAt: Generated; updatedAt: Generated; } StockAdjustmentLine: { id: Generated; stockAdjustmentId: string; itemId: string; storageLocationId: string; quantity: string; adjustmentDirection: "INCREASE" | "DECREASE" | null; fromStockCategory: "AVAILABLE" | "BLOCKED" | null; unitCost: string | null; createdAt: Generated; updatedAt: Generated; } StockLevel: { id: Generated; itemId: string; storageLocationId: string; stockType: "AVAILABLE" | "BLOCKED" | "IN_TRANSIT"; quantity: string; createdAt: Generated; updatedAt: Generated; } StockReservation: { id: Generated; sourceType: "SALES_ORDER" | "TRANSFER_ORDER"; sourceId: string; sourceLineId: string; itemId: string; siteId: string; storageLocationId: string | null; reservedQuantity: string; consumedQuantity: string; status: "OPEN" | "CLOSED"; requiredDate: Timestamp; createdAt: Generated; updatedAt: Generated; } StorageLocation: { id: Generated; name: string; code: string | null; siteId: string; storageCondition: string | null; capacity: string | null; status: "ACTIVE" | "INACTIVE"; createdAt: Generated; updatedAt: Generated; } TransferOrder: { id: Generated; sourceSiteId: string; destinationSiteId: string; plannedShipmentDate: Timestamp; expectedReceiptDate: Timestamp; status: "DRAFT" | "OPEN" | "CLOSED"; closedAt: Timestamp | null; createdAt: Generated; updatedAt: Generated; } TransferOrderLine: { id: Generated; transferOrderId: string; itemId: string; unitId: string; orderedQuantity: string; shippedQuantity: string; receivedQuantity: string; createdAt: Generated; updatedAt: Generated; } ValuationPolicy: { id: Generated; name: string; companyId: string; costingMethod: "STANDARD" | "FIFO" | "AVERAGE"; defaultCompanyId: string | null; inventoryAccountId: string; accrualAccountId: string; invoicePriceVarianceAccountId: string; cogsAccountId: string; ppvAccountId: string; adjustmentAccountId: string; standardCostAdjustmentAccountId: string; consumedPriceVarianceAccountId: string; createdAt: Generated; updatedAt: Generated; } } } export const getDB = createGetDB(); export type DB = NamespaceDB; export type Transaction = NamespaceTransaction; type TableName = NamespaceTableName; export type Table = NamespaceTable; export type Insertable = NamespaceInsertable; export type Selectable = NamespaceSelectable; export type Updateable = NamespaceUpdateable;