import React from "react";

import TButton from "../../../../../components/TButton/TButton";
import { $L } from "../../../../../utils/helperMethods";
import css from "../components/OrderListCardStatus.module.less";

export const getStatusMessageAndClass = (shptmOrdStCd, shptmOrdStNm) => {
  switch (shptmOrdStCd) {
    case "ORD00601":
    case "ORD00602":
    case "ORD00603":
      return { message: shptmOrdStNm, className: css.orderGreen };

    case "ORD00604":
      return { message: shptmOrdStNm, className: css.orderGreen };

    case "ORD00605":
    case "ORD00606":
    case "ORD00607":
    case "ORD00608":
    case "ORD00609":
    case "ORD00610":
      return { message: shptmOrdStNm, className: css.orderGreen };

    case "ORD00611":
    case "ORD00612":
    case "ORD00613":
      return { message: shptmOrdStNm, className: css.orderGreen };

    case "ORD00614":
    case "ORD00615":
    case "ORD00616":
      return { message: shptmOrdStNm, className: css.orderGreen };

    case "ORD00620":
      return { message: shptmOrdStNm, className: css.orderGreen };

    case "ORD00630":
    case "ORD00621":
    case "ORD00622":
    case "ORD00623":
      return { message: shptmOrdStNm, className: css.orderGreen };

    case "ORD00690":
      return { message: shptmOrdStNm, className: css.orderGreen };

    default:
      return { message: shptmOrdStNm, className: css.orderGreen };
  }
};

export const renderButtonsByStatus = (shptmOrdStCd, ordNo, onClickHandlers) => {
  const {
    _onClickBuyAgain,
    onClickCancelItem,
    onClickReturnExchange,
    onClickTrackPackage,
  } = onClickHandlers;

  switch (shptmOrdStCd) {
    case "ORD00601":
    case "ORD00620":
      return (
        <>
          <TButton
            size="small"
            className={css.actionButton}
            onClick={onClickCancelItem}
          >
            {$L("CANCEL ITEM")}
          </TButton>
        </>
      );
    case "ORD00602":
      return (
        <>
          <TButton
            size="small"
            className={css.actionButton}
            onClick={onClickReturnExchange}
            withMarquee
          >
            {$L("RETURN/EXCHANGE")}
          </TButton>
        </>
      );
    case "ORD00603":
    case "ORD00604":
      return (
        <>
          <TButton
            size="small"
            className={css.actionButton}
            onClick={onClickReturnExchange}
            withMarquee
          >
            {$L("RETURN/EXCHANGE")}
          </TButton>
          <TButton
            size="small"
            className={css.actionButton}
            onClick={onClickTrackPackage}
          >
            {$L("TRACK PACKAGE")}
          </TButton>
        </>
      );
    case "ORD00605":
    case "ORD00606":
    case "ORD00607":
      return <></>;
    case "ORD00608":
    case "ORD00609":
    case "ORD00610":
      return (
        <>
          <TButton
            size="small"
            className={css.actionButton}
            onClick={onClickTrackPackage}
          >
            {$L("TRACK PACKAGE")}
          </TButton>
        </>
      );
    case "ORD00611":
    case "ORD00612":
      return (
        <>
          <TButton
            size="small"
            className={css.actionButton}
            onClick={onClickTrackPackage}
          >
            {$L("TRACK PACKAGE")}
          </TButton>
        </>
      );
    case "ORD00613":
      return (
        <>
          <TButton
            size="small"
            className={css.actionButton}
            onClick={onClickReturnExchange}
            withMarquee
          >
            {$L("RETURN/EXCHANGE")}
          </TButton>
          <TButton
            size="small"
            className={css.actionButton}
            onClick={onClickTrackPackage}
          >
            {$L("TRACK PACKAGE")}
          </TButton>
        </>
      );
    case "ORD00614":
    case "ORD00615":
    case "ORD00616":
    case "ORD00630":
    case "ORD00621":
    case "ORD00622":
    case "ORD00623":
      return null;

    default:
      return null;
  }
};
