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": { BillOfMaterial: { id: Generated; parentItemId: string; companyId: string; siteId: string | null; bomType: "MANUFACTURE" | "PHANTOM" | "KIT"; effectivityStartDate: Timestamp | null; effectivityEndDate: Timestamp | null; defaultSelection: boolean | null; revisionNumber: string | null; status: "DRAFT" | "ACTIVE" | "INACTIVE"; createdAt: Generated; updatedAt: Generated; } BillOfMaterialLine: { id: Generated; billOfMaterialId: string; itemId: string; requiredQuantity: number; unitOfMeasure: string | null; scrapAssumption: number | null; isSubassembly: boolean | null; createdAt: Generated; updatedAt: Generated; } CostVarianceLine: { id: Generated; costSummaryId: string; varianceType: "MATERIAL_PRICE" | "MATERIAL_USAGE" | "LABOR_RATE" | "LABOR_EFFICIENCY" | "MACHINE_RATE" | "MACHINE_EFFICIENCY" | "SCRAP" | "YIELD"; amount: number; accountReference: string | null; variancePercentage: number | null; createdAt: Generated; updatedAt: Generated; } ManufacturingCostLine: { id: Generated; costSummaryId: string; costType: string; plannedAmount: number; actualAmount: number; createdAt: Generated; updatedAt: Generated; } ManufacturingCostSettlementRecord: { id: Generated; costSummaryId: string; settlementDate: Timestamp; settlementReference: string; acknowledgedDate: Timestamp | null; createdAt: Generated; updatedAt: Generated; } ManufacturingCostSummary: { id: Generated; productionOrderId: string; plannedMaterialCost: number; plannedLaborCost: number; plannedMachineCost: number; plannedOverheadCost: number; actualMaterialCost: number; actualLaborCost: number; actualMachineCost: number; actualOverheadCost: number; currencyCode: string; reviewedDate: Timestamp | null; reviewerNotes: string | null; status: "COLLECTING" | "PENDING_VARIANCE_REVIEW" | "VARIANCE_REVIEWED" | "SETTLED"; createdAt: Generated; updatedAt: Generated; } ProductionOrder: { id: Generated; orderedItemId: string; companyId: string; siteId: string; plannedQuantity: number; plannedStartDate: Timestamp; plannedEndDate: Timestamp; selectedBomVersionId: string | null; selectedRoutingRevisionId: string | null; status: "DRAFT" | "RELEASED" | "CANCELLED" | "IN_PROGRESS" | "COMPLETED" | "TECHNICALLY_COMPLETE" | "CLOSED"; createdAt: Generated; updatedAt: Generated; } ProductionOrderBomSnapshot: { id: Generated; productionOrderId: string; parentItemId: string; bomType: string; snapshotData: string | null; createdAt: Generated; updatedAt: Generated; } ProductionOrderCostBaseline: { id: Generated; productionOrderId: string; plannedMaterialCost: number; plannedLaborCost: number; plannedMachineCost: number; plannedOverheadCost: number; currencyCode: string; createdAt: Generated; updatedAt: Generated; } ProductionOrderMaterialRequirement: { id: Generated; productionOrderId: string; itemId: string; requiredQuantity: number; unitOfMeasure: string | null; plannedUnitCost: number | null; createdAt: Generated; updatedAt: Generated; } ProductionOrderRoutingSnapshot: { id: Generated; productionOrderId: string; routingId: string; snapshotData: string | null; createdAt: Generated; updatedAt: Generated; } Routing: { id: Generated; parentItemId: string; companyId: string; siteId: string | null; revisionNumber: string | null; status: "DRAFT" | "ACTIVE" | "INACTIVE"; createdAt: Generated; updatedAt: Generated; } RoutingOperation: { id: Generated; routingId: string; sequenceNumber: number; operationDescription: string | null; workCenterId: string; standardSetupTime: number; standardRunTime: number; operatorInstructions: string | null; createdAt: Generated; updatedAt: Generated; } WorkCenter: { id: Generated; code: string; companyId: string; siteId: string | null; status: "DRAFT" | "INACTIVE" | "ACTIVE"; capacityAssumptions: number; laborRate: number | null; machineRate: number | null; calendarReference: string | null; overheadAbsorptionMethod: "PERCENT_OF_LABOR_COST" | "PERCENT_OF_MACHINE_COST" | "FIXED_AMOUNT_PER_GOOD_UNIT" | null; overheadAbsorptionCurrency: string | null; createdAt: Generated; updatedAt: Generated; } WorkOrder: { id: Generated; productionOrderId: string; routingOperationSequenceNumber: number; workCenterId: string; plannedQuantity: number; completedQuantity: number; scrapQuantity: number; actualSetupTime: number; actualRunTime: number; actualStartDate: Timestamp | null; pauseReason: string | null; executionNotes: string | null; status: "PENDING" | "IN_PROGRESS" | "PAUSED" | "COMPLETE" | "CANCELLED"; createdAt: Generated; updatedAt: Generated; } WorkOrderExecutionEvent: { id: Generated; workOrderId: string; eventType: "STARTED" | "PAUSED" | "RESUMED" | "PROGRESS_REPORTED" | "COMPLETED"; timestamp: Timestamp; quantity: number | null; timeValue: number | null; scrapValue: number | null; notes: string | null; 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;