import { PATHS } from '@/shared/constants/paths';
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { 
  PaymentTabKeys,
  PaymentTabProps
} from '../model/types';

export const PaymentTab = ({
  activeTab
}: PaymentTabProps) => {
  const { navigate } = useNavigate();

  const onClickToNavigation = (tab: PaymentTabKeys) => {
    if(activeTab !== tab){
      if(tab === PaymentTabKeys.Info){
        navigate(PATHS.payment.info);
      }
      else if(tab === PaymentTabKeys.DataNotification){
        navigate(PATHS.payment.dataNotification);
      }
    }
  };
  return(
    <>
      <div className="subTab">
        <button 
          className={`subtab-btn ${(activeTab === PaymentTabKeys.Info)? 'active': ''}` }
          onClick={ () => onClickToNavigation(PaymentTabKeys.Info) } 
        >결제 정보</button>
        <button 
          className={`subtab-btn ${(activeTab === PaymentTabKeys.DataNotification)? 'active': ''}` }
          onClick={ () => onClickToNavigation(PaymentTabKeys.DataNotification) } 
        >결제데이터 통보</button>
      </div>
    </>
  );
};