import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState, useEffect } from 'react';
import CardHeader from '../CardHeader';
import OrderDetails from '../OrderDetails';
import OrderProductsList from '../OrderProductsList';
import UserInformation from '../UserInformation';
import { ContentWrapper, KDSCardWrapper } from './style';
import { getBackgroundColor, getElements } from '../utils/helperFunctions';
import ButtonClose from '../Buttons/ButtonClose';
import ButtonsContainer from '../ButtonsContainer';
const KDSCard = (props) => {
    const { orderType, lastChanged, bucket, orderId, payments, due, extra, deliveryAddress, comments, users, venueConfig, callOrderApi, authProvider, verifiedTime, } = props;
    const { toDone, allDone, toPrepare, toConfirm } = getElements(bucket.lines);
    const [isZoomIn, setIsZoomIn] = useState(false);
    useEffect(() => {
        if (isZoomIn) {
            document.body.style.overflow = 'hidden';
        }
        else {
            document.body.style.overflow = 'auto';
        }
    }, [isZoomIn]);
    console.log(props);
    return (_jsxs(KDSCardWrapper, Object.assign({ isZoomIN: isZoomIn }, { children: [isZoomIn && _jsx(ButtonClose, { setIsZoomIn: setIsZoomIn }, void 0), _jsx(CardHeader, { verifiedTime: verifiedTime, orderType: orderType, due: due, venueConfig: venueConfig }, void 0), _jsx(OrderDetails, { queuePos: bucket.queuePos, lines: bucket.lines, lastChanged: lastChanged, orderType: orderType, payments: payments, orderId: orderId }, void 0), _jsxs(ContentWrapper, Object.assign({ isZoomIn: isZoomIn, color: getBackgroundColor(allDone, toDone, toConfirm, toPrepare) }, { children: [_jsx(OrderProductsList, { lines: bucket.lines, orderId: orderId, currency: venueConfig.currency, isZoomIN: isZoomIn }, void 0), _jsx(UserInformation, { extra: extra, deliveryAddress: deliveryAddress, comments: comments, users: users, kdsLayout: "" }, void 0), _jsx(ButtonsContainer, { callOrderApi: callOrderApi, setIsZoomIn: setIsZoomIn, isZoomIn: isZoomIn, lines: bucket.lines, orderId: orderId, authProvider: authProvider }, void 0)] }), void 0)] }), void 0));
};
export default KDSCard;
//# sourceMappingURL=index.js.map