import React, { useEffect } from 'react'
import { useSelectedProduct } from '../../../../store/simulation/useSimulationStore';
import { useProductStore } from '../../../../store/simulation/useProductStore';
import { determineExecutionMachineSequences } from '../../simulator/functions/determineExecutionMachineSequences';
export default function ThroughPut() {
    const { selectedProduct } = useSelectedProduct();
    const { products,getProductById } = useProductStore()

    useEffect(() => {
        let productData = getProductById(selectedProduct.productId)
        if (productData) {
            let productSequenceData = determineExecutionMachineSequences([productData])
            console.log('productSequenceData: ', productSequenceData);
            if (productSequenceData?.length > 0) {
                let totalItems = 0;  // 👈 initialize total count
                productSequenceData.map((sequence, index) => {
                    totalItems += sequence.length;
                    //   sequence.map((item, idx) => {});
                });
                console.log(`Total items across all sequences: ${totalItems}`); // 👈 FINAL TOTAL ✅
            } else {
                console.log('No productSequenceData found!');
            }
        }
    }, [products])

    return (
        <>
        </>
    )
}