import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import { addTimezone, getTime } from '@orderingstack/front-components-common';
import { getBackgroundColor, getElements } from '../utils/helperFunctions';
import OrderPayments from '../OrderPayments';
// styles
import { OrderDetailsWrapper, OrderTimeBlock, QueuePosBlock, OrderTypeBlock, OrderIdBlock, } from './style';
// translation
import { useTranslation } from 'react-i18next';
const OrderDetails = (props) => {
    const { queuePos, lines, lastChanged, orderType, payments, orderId } = props;
    const { t } = useTranslation();
    const checkOrderType = () => {
        switch (orderType) {
            case 'TAKE_AWAY':
                return t('OS.KDS.Card.OrderType.SelfPickUp');
            case 'DELIVERY':
                return t('OS.KDS.Card.OrderType.Delivery');
            case 'DINE_IN':
                return t('OS.KDS.Card.OrderType.DineIn');
            default:
                return 'None';
        }
    };
    const { toDone, allDone, toPrepare, toConfirm } = getElements(lines);
    const formattedLastChange = getTime(addTimezone(lastChanged));
    return (_jsxs(_Fragment, { children: [_jsxs(OrderDetailsWrapper, { children: [_jsxs(QueuePosBlock, Object.assign({ color: getBackgroundColor(allDone, toDone, toConfirm, toPrepare) }, { children: ["No. ", ` `, queuePos] }), void 0), _jsx(OrderTimeBlock, { children: formattedLastChange }, void 0), _jsxs(OrderTypeBlock, { children: [checkOrderType(), " "] }, void 0), _jsx(OrderPayments, { payments: payments }, void 0)] }, void 0), _jsxs(OrderIdBlock, { children: [_jsx("strong", { children: "ID:" }, void 0), " ", orderId] }, void 0)] }, void 0));
};
export default OrderDetails;
//# sourceMappingURL=index.js.map