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

export const VatReturnTab = ({
  activeTab
}: VatReturnTabProps) => {
  const { navigate } = useNavigate();

  const onClickToNavigation = (tab: VatReturnTabKeys) => {
    if(activeTab !== tab){
      if(tab === VatReturnTabKeys.List){
        navigate(PATHS.vatReturn.list);
      }
      else if(tab === VatReturnTabKeys.VatReference){
        navigate(PATHS.vatReturn.reference);
      }
    }
  };
  return(
    <>
      <div className="subTab">
        <button 
          className={`subtab-btn ${(activeTab === VatReturnTabKeys.List)? 'active': ''}` }
          onClick={ () => onClickToNavigation(VatReturnTabKeys.List) } 
        >세금 계산서</button>
        <button 
          className={`subtab-btn ${(activeTab === VatReturnTabKeys.VatReference)? 'active': ''}` }
          onClick={ () => onClickToNavigation(VatReturnTabKeys.VatReference) } 
        >부가세 참고</button>
      </div>
    </>
  );
};