import { BottomSheetMotionDuration, BottomSheetMotionVaiants } from '@/entities/common/model/constant';
import { IMAGE_ROOT } from '@/shared/constants/common';
import { motion } from 'framer-motion';

export interface CashReceitPurposeUpdateBottomSheetProps {
  bottomSheetOn: boolean;
  setBottomSheetOn: (bottomSheetOn: boolean) => void;
  callPurposeUpdate: () => void;
};

export const CashReceitPurposeUpdateBottomSheet = ({
  bottomSheetOn,
  setBottomSheetOn,
  callPurposeUpdate
}: CashReceitPurposeUpdateBottomSheetProps) => {
  
  const onClickToClose = () => {
    setBottomSheetOn(false);
  };
  const onCliickToPurposeUpdate = () => {
    callPurposeUpdate();
  };
  
  return (
    <>
      { (bottomSheetOn) &&
        <div className="bg-dim"></div>
      }
      <motion.div 
        className="bottomsheet"
        initial="hidden"
        animate={ (bottomSheetOn)? 'visible': 'hidden' }
        variants={ BottomSheetMotionVaiants }
        transition={ BottomSheetMotionDuration }
      >
        <div className="bottomsheet-header">
          <div className="bottomsheet-title">
            <h2>현금영수증 용도 변경 안내</h2>
            <button
              className="close-btn"
              type="button"
            >
              <img 
                src={ IMAGE_ROOT + '/ico_close.svg' }
                alt="닫기"
                onClick={ () => onClickToClose() }
              />
            </button>
          </div>
        </div>

        <div className="bottomsheet-content">
          <div className="bottom-section">
            <p>현금영수증의 용도 변경 시 기존 발급 내역이 취소되며, 선택한 용도에 맞게 새로 발급됩니다. </p>
            <ul className="list-style-circle">
              <li>지출증빙용 → 소득공제용</li>
              <li>소득공제용 → 지출증빙용</li>
            </ul>
          </div>
        </div>

        <div className="bottomsheet-footer">
          <button
            className="btn-50 btn-blue flex-1"
            type="button"
            onClick={ () => onCliickToPurposeUpdate() }
          >신청</button>
        </div>
      </motion.div>
    </>
  );
};