import moment from 'moment';
import { motion } from 'framer-motion';
import { DetailInfoKeys, DetailInfoProps } from '@/entities/settlement/model/types';
import { DetailArrow } from './detail-arrow';

export const DetailSettlementInfo = ({
  settlementInfo,
  show,
  onClickToShowInfo
}: DetailInfoProps) => {
  const variants = {
    hidden: { height: 0, padding: 0, display: 'none' },
    visible: { height: 'auto', paddingTop: '12px', display: 'block' },
  };

  const onClickToSetShowInfo = () => {
    if(!!onClickToShowInfo){
      onClickToShowInfo(DetailInfoKeys.Settlement);
    }
  };

  return (
    <>
      <div className="txn-section">
        <div 
          className="section-title with-toggle"
          onClick={ () => onClickToSetShowInfo() }
        >
          정산 정보 <DetailArrow show={ show }></DetailArrow>
        </div>
        <motion.ul 
          className="kv-list"
          initial="hidden"
          animate={ (show)? 'visible': 'hidden' }
          variants={ variants }
          transition={{ duration: 0.3 }}
        >
          <li className="kv-row">
            <span className="k">MID</span>
            <span className="v">cruquis01m</span>
          </li>
          <li className="kv-row">
            <span className="k">이체상태</span>
            <span className="v">정상처리</span>
          </li>
          <li className="kv-row">
            <span className="k">이체ID</span>
            <span className="v">APG000600m</span>
          </li>
          <li className="kv-row">
            <span className="k">이체시간</span>
            <span className="v">12:00:00</span>
          </li>
          <li className="kv-row">
            <span className="k">계좌번호</span>
            <span className="v">123231231****</span>
          </li>
          <li className="kv-row">
            <span className="k">입금인자</span>
            <span className="v">나이스페이먼츠</span>
          </li>
          <li className="kv-row">
            <span className="k">정상입금액</span>
            <span className="v">5,731,742</span>
          </li>
          <li className="kv-row nopadding">
            <span className="k">오류사유</span>
            <span className="v"></span>
          </li>
        </motion.ul>
      </div>
    </>
  );
};