// based on ScanCrptContext.tsx (src/screens/AssemblyScreen/contexts/ScanCrptContext.tsx) create new context

import {createContext, FC} from "react";
import {OrderProduct} from "../../../types/order";
import {useDispatch} from "react-redux";

type ScanCrptProps = {
    orderProduct: OrderProduct;
    onScanned: (data: string) => void;
}

type AssemblyContextState = {
    scanCrpt: (props: ScanCrptProps) => void;
}
const AssemblyContext = createContext<AssemblyContextState | undefined>(
    undefined
);

const useAssemblyContextState = () => {
    const dispatch = useDispatch();

    const scanCrpt = (props: ScanCrptProps) => {

    }

    return {scanCrpt}
};

type AssemblyContextProviderProps = {
    children: React.ReactNode;
};

export const AssemblyContextProvider: FC<AssemblyContextProviderProps> = ({
                                                                              children,
                                                                          }) => {
    const state = useAssemblyContextState();
    return (
        <AssemblyContext.Provider value={state}>
            {children}
        </AssemblyContext.Provider>
    );
};
