import { Prisma } from '../generated/prisma/index';
import { PrismaService } from '../prisma/prisma.service';
import { SfgItemWriteDto, SfgQuery, WorkbookImportDto } from './sfg-bom.dto';
type CostSummary = {
    materialCost: number;
    machineCost: number;
    coatingCost: number;
    totalCost: number;
};
type ResolvedBomItem = {
    childCode: string;
    childName: string;
    childItemType: string;
    quantity: number;
    branchType: string;
    finishVariant: string;
    plateCodes: string[];
    materialCost: number;
    machineCost: number;
    coatingCost: number;
    totalCost: number;
    detailLines: any[];
    nestedBom: ResolvedBomHeader | null;
};
type ResolvedBomHeader = {
    id: string;
    bomType: string;
    parentCode: string;
    parentName: string;
    parentItemType: string;
    items: ResolvedBomItem[];
    summary: CostSummary;
};
export declare class SfgBomService {
    private readonly prisma;
    constructor(prisma: PrismaService);
    options(): Promise<{
        sfgTypes: string[];
        bomTypes: string[];
        processTypes: string[];
        statuses: string[];
        inches: string[];
        finalProductInches: string[];
        sfgItems: {
            id: string;
            status: string;
            createdAt: Date;
            updatedAt: Date;
            itemCode: string;
            itemName: string;
            itemGroup: string | null;
            sfgType: string;
            purchaseUom: string | null;
            stockUom: string | null;
            conversionRatio: number;
            billingItem: boolean;
            bom: boolean;
            stockMaintain: boolean;
            minStockLevel: number;
            maxStockLevel: number;
            rate: number;
            costPrice: number;
            inch: string | null;
            sourceData: Prisma.JsonValue;
        }[];
        machines: {
            id: string;
            status: string;
            createdAt: Date;
            updatedAt: Date;
            name: string | null;
            moduleType: string;
            machineryName: string;
            machineryNumber: string;
            eachHp: number;
            hourRate: number;
            code: string | null;
            tonnage: number | null;
            noOfPlatens: number | null;
            platenSize: string | null;
            powerPackHp: number | null;
            heaterCapacity: number | null;
            heaterPerPlaten: number | null;
            noOfPlates: number | null;
            coolingTower: number | null;
            powerPack: number | null;
            heaterPack: number | null;
            coolingTowerCost: number | null;
        }[];
        fgProducts: never[];
        bomParents: {
            id: string;
            status: string;
            createdAt: Date;
            updatedAt: Date;
            bomType: string;
            parentCode: string;
            parentName: string;
            parentItemType: string;
            parentSfgItemId: string | null;
            parentSetProductId: string | null;
            sourceSheet: string | null;
        }[];
    }>;
    listItems(query: SfgQuery): Promise<{
        items: {
            id: string;
            status: string;
            createdAt: Date;
            updatedAt: Date;
            itemCode: string;
            itemName: string;
            itemGroup: string | null;
            sfgType: string;
            purchaseUom: string | null;
            stockUom: string | null;
            conversionRatio: number;
            billingItem: boolean;
            bom: boolean;
            stockMaintain: boolean;
            minStockLevel: number;
            maxStockLevel: number;
            rate: number;
            costPrice: number;
            inch: string | null;
            sourceData: Prisma.JsonValue;
        }[];
        meta: {
            total: number;
            page: number;
            pageSize: number;
            totalPages: number;
        };
        filterOptions: {
            sfgTypes: string[];
            bomTypes: string[];
            processTypes: string[];
            statuses: string[];
            inches: string[];
            finalProductInches: string[];
            sfgItems: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                itemCode: string;
                itemName: string;
                itemGroup: string | null;
                sfgType: string;
                purchaseUom: string | null;
                stockUom: string | null;
                conversionRatio: number;
                billingItem: boolean;
                bom: boolean;
                stockMaintain: boolean;
                minStockLevel: number;
                maxStockLevel: number;
                rate: number;
                costPrice: number;
                inch: string | null;
                sourceData: Prisma.JsonValue;
            }[];
            machines: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                name: string | null;
                moduleType: string;
                machineryName: string;
                machineryNumber: string;
                eachHp: number;
                hourRate: number;
                code: string | null;
                tonnage: number | null;
                noOfPlatens: number | null;
                platenSize: string | null;
                powerPackHp: number | null;
                heaterCapacity: number | null;
                heaterPerPlaten: number | null;
                noOfPlates: number | null;
                coolingTower: number | null;
                powerPack: number | null;
                heaterPack: number | null;
                coolingTowerCost: number | null;
            }[];
            fgProducts: never[];
            bomParents: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                bomType: string;
                parentCode: string;
                parentName: string;
                parentItemType: string;
                parentSfgItemId: string | null;
                parentSetProductId: string | null;
                sourceSheet: string | null;
            }[];
        };
    }>;
    getItem(id: string): Promise<{
        processes: {
            id: string;
            status: string;
            createdAt: Date;
            updatedAt: Date;
            itemCode: string;
            itemName: string;
            inch: string | null;
            sourceData: Prisma.JsonValue;
            hourRate: number;
            processCode: string;
            sfgItemId: string | null;
            processName: string;
            processType: string;
            setupTime: number;
            processTime: number;
            inspectionTime: number;
            inspectionRequired: boolean;
            toolsDie: string | null;
            machineryId: string | null;
            machineName: string | null;
            description: string | null;
            reqMaterialCode: string | null;
            reqMaterialQty: number;
            machineCost: number;
            costingProcessId: string | null;
        }[];
        parentBoms: ({
            items: {
                id: string;
                createdAt: Date;
                updatedAt: Date;
                sourceData: Prisma.JsonValue;
                sourceSheet: string | null;
                bomId: string;
                childCode: string;
                childName: string;
                childItemType: string;
                childSfgItemId: string | null;
                rawMaterialId: string | null;
                quantity: number;
                newQuantity: number | null;
                uom: string | null;
                wastagePercent: number;
                costPerUnit: number;
                totalMaterialCost: number;
            }[];
        } & {
            id: string;
            status: string;
            createdAt: Date;
            updatedAt: Date;
            bomType: string;
            parentCode: string;
            parentName: string;
            parentItemType: string;
            parentSfgItemId: string | null;
            parentSetProductId: string | null;
            sourceSheet: string | null;
        })[];
        childBoms: ({
            bom: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                bomType: string;
                parentCode: string;
                parentName: string;
                parentItemType: string;
                parentSfgItemId: string | null;
                parentSetProductId: string | null;
                sourceSheet: string | null;
            };
        } & {
            id: string;
            createdAt: Date;
            updatedAt: Date;
            sourceData: Prisma.JsonValue;
            sourceSheet: string | null;
            bomId: string;
            childCode: string;
            childName: string;
            childItemType: string;
            childSfgItemId: string | null;
            rawMaterialId: string | null;
            quantity: number;
            newQuantity: number | null;
            uom: string | null;
            wastagePercent: number;
            costPerUnit: number;
            totalMaterialCost: number;
        })[];
        costRecords: any;
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        itemCode: string;
        itemName: string;
        itemGroup: string | null;
        sfgType: string;
        purchaseUom: string | null;
        stockUom: string | null;
        conversionRatio: number;
        billingItem: boolean;
        bom: boolean;
        stockMaintain: boolean;
        minStockLevel: number;
        maxStockLevel: number;
        rate: number;
        costPrice: number;
        inch: string | null;
        sourceData: Prisma.JsonValue;
    }>;
    createItem(dto: SfgItemWriteDto): Promise<{
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        itemCode: string;
        itemName: string;
        itemGroup: string | null;
        sfgType: string;
        purchaseUom: string | null;
        stockUom: string | null;
        conversionRatio: number;
        billingItem: boolean;
        bom: boolean;
        stockMaintain: boolean;
        minStockLevel: number;
        maxStockLevel: number;
        rate: number;
        costPrice: number;
        inch: string | null;
        sourceData: Prisma.JsonValue;
    }>;
    updateItem(id: string, dto: SfgItemWriteDto): Promise<{
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        itemCode: string;
        itemName: string;
        itemGroup: string | null;
        sfgType: string;
        purchaseUom: string | null;
        stockUom: string | null;
        conversionRatio: number;
        billingItem: boolean;
        bom: boolean;
        stockMaintain: boolean;
        minStockLevel: number;
        maxStockLevel: number;
        rate: number;
        costPrice: number;
        inch: string | null;
        sourceData: Prisma.JsonValue;
    }>;
    deleteItem(id: string): Promise<{
        deleted: boolean;
    }>;
    listBoms(query: SfgQuery): Promise<{
        items: {
            id: string;
            bomType: string;
            parentCode: any;
            parentName: any;
            parentItemType: string;
            parentSfgItemId: null;
            parentSetProductId: any;
            sourceSheet: string;
            status: string;
            itemCount: any;
            image: any;
            holderCode: any;
            plateCode: any;
            wheelCode: any;
            inch: any;
            finishVariant: any;
            materialCost: number;
            machineCost: number;
            coatingCost: number;
            totalCost: number;
        }[];
        meta: {
            total: number;
            page: number;
            pageSize: number;
            totalPages: number;
        };
        filterOptions: {
            sfgTypes: string[];
            bomTypes: string[];
            processTypes: string[];
            statuses: string[];
            inches: string[];
            finalProductInches: string[];
            sfgItems: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                itemCode: string;
                itemName: string;
                itemGroup: string | null;
                sfgType: string;
                purchaseUom: string | null;
                stockUom: string | null;
                conversionRatio: number;
                billingItem: boolean;
                bom: boolean;
                stockMaintain: boolean;
                minStockLevel: number;
                maxStockLevel: number;
                rate: number;
                costPrice: number;
                inch: string | null;
                sourceData: Prisma.JsonValue;
            }[];
            machines: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                name: string | null;
                moduleType: string;
                machineryName: string;
                machineryNumber: string;
                eachHp: number;
                hourRate: number;
                code: string | null;
                tonnage: number | null;
                noOfPlatens: number | null;
                platenSize: string | null;
                powerPackHp: number | null;
                heaterCapacity: number | null;
                heaterPerPlaten: number | null;
                noOfPlates: number | null;
                coolingTower: number | null;
                powerPack: number | null;
                heaterPack: number | null;
                coolingTowerCost: number | null;
            }[];
            fgProducts: never[];
            bomParents: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                bomType: string;
                parentCode: string;
                parentName: string;
                parentItemType: string;
                parentSfgItemId: string | null;
                parentSetProductId: string | null;
                sourceSheet: string | null;
            }[];
        };
    } | {
        items: {
            itemCount: number;
            materialCost: number;
            machineCost: number;
            coatingCost: number;
            totalCost: number;
            items: {
                id: string;
                createdAt: Date;
                updatedAt: Date;
                sourceData: Prisma.JsonValue;
                sourceSheet: string | null;
                bomId: string;
                childCode: string;
                childName: string;
                childItemType: string;
                childSfgItemId: string | null;
                rawMaterialId: string | null;
                quantity: number;
                newQuantity: number | null;
                uom: string | null;
                wastagePercent: number;
                costPerUnit: number;
                totalMaterialCost: number;
            }[];
            id: string;
            status: string;
            createdAt: Date;
            updatedAt: Date;
            bomType: string;
            parentCode: string;
            parentName: string;
            parentItemType: string;
            parentSfgItemId: string | null;
            parentSetProductId: string | null;
            sourceSheet: string | null;
        }[];
        meta: {
            total: number;
            page: number;
            pageSize: number;
            totalPages: number;
        };
        filterOptions: {
            sfgTypes: string[];
            bomTypes: string[];
            processTypes: string[];
            statuses: string[];
            inches: string[];
            finalProductInches: string[];
            sfgItems: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                itemCode: string;
                itemName: string;
                itemGroup: string | null;
                sfgType: string;
                purchaseUom: string | null;
                stockUom: string | null;
                conversionRatio: number;
                billingItem: boolean;
                bom: boolean;
                stockMaintain: boolean;
                minStockLevel: number;
                maxStockLevel: number;
                rate: number;
                costPrice: number;
                inch: string | null;
                sourceData: Prisma.JsonValue;
            }[];
            machines: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                name: string | null;
                moduleType: string;
                machineryName: string;
                machineryNumber: string;
                eachHp: number;
                hourRate: number;
                code: string | null;
                tonnage: number | null;
                noOfPlatens: number | null;
                platenSize: string | null;
                powerPackHp: number | null;
                heaterCapacity: number | null;
                heaterPerPlaten: number | null;
                noOfPlates: number | null;
                coolingTower: number | null;
                powerPack: number | null;
                heaterPack: number | null;
                coolingTowerCost: number | null;
            }[];
            fgProducts: never[];
            bomParents: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                bomType: string;
                parentCode: string;
                parentName: string;
                parentItemType: string;
                parentSfgItemId: string | null;
                parentSetProductId: string | null;
                sourceSheet: string | null;
            }[];
        };
    }>;
    getBom(id: string): Promise<{
        id: string;
        bomType: string;
        parentCode: string;
        parentName: any;
        parentItemType: string;
        parentSfgItemId: null;
        parentSetProductId: string | null;
        sourceSheet: string;
        status: string;
        image: string;
        itemCount: number;
        summary: CostSummary;
        materialCost: number;
        machineCost: number;
        coatingCost: number;
        totalCost: number;
        items: {
            childCode: any;
            childName: any;
            childItemType: string;
            quantity: number;
            branchType: any;
            finishVariant: any;
            plateCodes: any;
            materialCost: any;
            machineCost: any;
            coatingCost: any;
            totalCost: any;
            detailLines: any;
            nestedBom: null;
        }[];
        extendedRows: {
            path: string;
            code: string;
            name: string;
            type: "HOLDER" | "WHEEL";
            quantity: number;
            finishVariant: any;
            plateCodes: any;
            materialCost: number;
            machineCost: number;
            coatingCost: number;
            totalCost: number;
            detailLines: any;
        }[];
        finalProductCosting: {
            fgCode: any;
            fgName: any;
            inch: any;
            image: string;
            finishVariant: string;
            holderCode: any;
            plateCode: any;
            wheelCode: any;
            holderSfgMaterialCost: number;
            holderSfgMachineCost: number;
            wheelSfgMaterialCost: number;
            wheelSfgMachineCost: number;
            subPartsMaterialCost: number;
            coatingOtherCost: number;
            totalSfgCost: number;
            finalFgProductCost: number;
            rows: Record<string, unknown>[];
            extendedRows: {
                path: string;
                code: string;
                name: string;
                type: "HOLDER" | "WHEEL";
                quantity: number;
                finishVariant: any;
                plateCodes: any;
                materialCost: number;
                machineCost: number;
                coatingCost: number;
                totalCost: number;
                detailLines: any;
            }[];
        };
    } | {
        summary: CostSummary;
        items: ResolvedBomItem[];
        extendedRows: any[];
        finalProductCosting: {
            fgCode: any;
            fgName: any;
            inch: any;
            image: string;
            finishVariant: string;
            holderCode: any;
            plateCode: any;
            wheelCode: any;
            holderSfgMaterialCost: number;
            holderSfgMachineCost: number;
            wheelSfgMaterialCost: number;
            wheelSfgMachineCost: number;
            subPartsMaterialCost: number;
            coatingOtherCost: number;
            totalSfgCost: number;
            finalFgProductCost: number;
            rows: Record<string, unknown>[];
            extendedRows: {
                path: string;
                code: string;
                name: string;
                type: "HOLDER" | "WHEEL";
                quantity: number;
                finishVariant: any;
                plateCodes: any;
                materialCost: number;
                machineCost: number;
                coatingCost: number;
                totalCost: number;
                detailLines: any;
            }[];
        } | null;
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        bomType: string;
        parentCode: string;
        parentName: string;
        parentItemType: string;
        parentSfgItemId: string | null;
        parentSetProductId: string | null;
        sourceSheet: string | null;
    }>;
    listProcesses(query: SfgQuery): Promise<{
        items: {
            id: string;
            status: string;
            createdAt: Date;
            updatedAt: Date;
            itemCode: string;
            itemName: string;
            inch: string | null;
            sourceData: Prisma.JsonValue;
            hourRate: number;
            processCode: string;
            sfgItemId: string | null;
            processName: string;
            processType: string;
            setupTime: number;
            processTime: number;
            inspectionTime: number;
            inspectionRequired: boolean;
            toolsDie: string | null;
            machineryId: string | null;
            machineName: string | null;
            description: string | null;
            reqMaterialCode: string | null;
            reqMaterialQty: number;
            machineCost: number;
            costingProcessId: string | null;
        }[];
        meta: {
            total: number;
            page: number;
            pageSize: number;
            totalPages: number;
        };
        filterOptions: {
            sfgTypes: string[];
            bomTypes: string[];
            processTypes: string[];
            statuses: string[];
            inches: string[];
            finalProductInches: string[];
            sfgItems: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                itemCode: string;
                itemName: string;
                itemGroup: string | null;
                sfgType: string;
                purchaseUom: string | null;
                stockUom: string | null;
                conversionRatio: number;
                billingItem: boolean;
                bom: boolean;
                stockMaintain: boolean;
                minStockLevel: number;
                maxStockLevel: number;
                rate: number;
                costPrice: number;
                inch: string | null;
                sourceData: Prisma.JsonValue;
            }[];
            machines: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                name: string | null;
                moduleType: string;
                machineryName: string;
                machineryNumber: string;
                eachHp: number;
                hourRate: number;
                code: string | null;
                tonnage: number | null;
                noOfPlatens: number | null;
                platenSize: string | null;
                powerPackHp: number | null;
                heaterCapacity: number | null;
                heaterPerPlaten: number | null;
                noOfPlates: number | null;
                coolingTower: number | null;
                powerPack: number | null;
                heaterPack: number | null;
                coolingTowerCost: number | null;
            }[];
            fgProducts: never[];
            bomParents: {
                id: string;
                status: string;
                createdAt: Date;
                updatedAt: Date;
                bomType: string;
                parentCode: string;
                parentName: string;
                parentItemType: string;
                parentSfgItemId: string | null;
                parentSetProductId: string | null;
                sourceSheet: string | null;
            }[];
        };
    }>;
    finalProductOptions(query: SfgQuery): Promise<{
        items: {
            image: string;
            id: string;
            wheelName: string;
            wheelCode: string;
            createdAt: Date;
            updatedAt: Date;
            setId: string;
            holderCode: string;
            holderName: string;
            plateCode: string;
            plateName: string;
            brakeName: string;
            finishType: string;
            finishLabel: string;
            productName: string;
            productCode: string;
            productInch: number;
            set: {
                id: string;
                createdAt: Date;
                updatedAt: Date;
                holderCode: string;
                holderName: string;
                productInch: number;
                setNumber: number;
                plateCount: number;
                finishCount: number;
                wheelCount: number;
            };
        }[];
        meta: {
            total: number;
            page: number;
            pageSize: number;
            totalPages: number;
        };
        inches: string[];
    }>;
    finalCost(query: SfgQuery): Promise<{
        fgCode: any;
        fgName: any;
        inch: any;
        image: string;
        finishVariant: string;
        holderCode: any;
        plateCode: any;
        wheelCode: any;
        holderSfgMaterialCost: number;
        holderSfgMachineCost: number;
        wheelSfgMaterialCost: number;
        wheelSfgMachineCost: number;
        subPartsMaterialCost: number;
        coatingOtherCost: number;
        totalSfgCost: number;
        finalFgProductCost: number;
        rows: Record<string, unknown>[];
        extendedRows: {
            path: string;
            code: string;
            name: string;
            type: "HOLDER" | "WHEEL";
            quantity: number;
            finishVariant: any;
            plateCodes: any;
            materialCost: number;
            machineCost: number;
            coatingCost: number;
            totalCost: number;
            detailLines: any;
        }[];
    } | {
        items: {
            fgCode: any;
            fgName: any;
            inch: any;
            image: string;
            finishVariant: string;
            holderCode: any;
            plateCode: any;
            wheelCode: any;
            holderSfgMaterialCost: number;
            holderSfgMachineCost: number;
            wheelSfgMaterialCost: number;
            wheelSfgMachineCost: number;
            subPartsMaterialCost: number;
            coatingOtherCost: number;
            totalSfgCost: number;
            finalFgProductCost: number;
            rows: Record<string, unknown>[];
            extendedRows: {
                path: string;
                code: string;
                name: string;
                type: "HOLDER" | "WHEEL";
                quantity: number;
                finishVariant: any;
                plateCodes: any;
                materialCost: number;
                machineCost: number;
                coatingCost: number;
                totalCost: number;
                detailLines: any;
            }[];
        }[];
        meta: {
            total: number;
            page: number;
            pageSize: number;
            totalPages: number;
        };
        inches: string[];
    }>;
    private listFinalProductCosts;
    private listFinalProductBoms;
    private buildFinalProductBomByCode;
    private mapFinalProductCostToBomListItem;
    private buildFinalProductCostByCode;
    private findFinalProductForCosting;
    private buildFinalProductCost;
    private findFinalCostCandidates;
    private pickFinalCostRecord;
    private scoreFinalCostRecord;
    private mapFinalCostRow;
    previewWorkbook(dto: WorkbookImportDto): Promise<{
        fileSheets: string[];
        rows: {
            sfgItems: number;
            fgBom: number;
            itemProcesses: number;
            subPartsBom: number;
            holderSummary: number;
            wheelSummary: number;
        };
    }>;
    importWorkbook(dto: WorkbookImportDto): Promise<{
        fileSheets: string[];
        rows: {
            sfgItems: number;
            fgBom: number;
            itemProcesses: number;
            subPartsBom: number;
            holderSummary: number;
            wheelSummary: number;
        };
        imported: {
            sfgItems: number;
            fgBomHeaders: number;
            fgBomItems: number;
            subPartBomHeaders: number;
            subPartBomItems: number;
            itemProcesses: number;
            machinery: number;
            holderCostRecords: number;
            holderCostLines: number;
            wheelCostRecords: number;
            wheelCostLines: number;
        };
        errors: string[];
    }>;
    exportItems(format?: string): Promise<import("../common/tabular-file.util").ExportFile>;
    exportProcesses(format?: string): Promise<import("../common/tabular-file.util").ExportFile>;
    exportBoms(format?: string, bomType?: string): Promise<import("../common/tabular-file.util").ExportFile>;
    private prepareItem;
    private readWorkbookCounts;
    private normalizeImportBundle;
    private normalizeImportFile;
    private importSfgItems;
    private importBomSheet;
    private importItemProcesses;
    private importCostingRecords;
    private findMatchingSfgItem;
    private findOrCreateMachine;
    private nextMachineryNumber;
    private itemWhere;
    private bomWhere;
    private processWhere;
    private bomInchWhere;
    private finalProductWhere;
    private listFinalProductInches;
    private buildResolutionMaps;
    private resolveBomHeader;
    private resolveBomItem;
    private findNestedHeader;
    private findCostRecord;
    private flattenResolvedItems;
    private costRecordSummary;
    private scaleDetailLines;
}
export {};
