import { motion } from 'framer-motion';
import {
    FilterMotionDuration,
    FilterMotionStyle,
    FilterMotionVariants
} from '@/entities/common/model/constant';

export interface LinkPaymentApplySuccessPageProps {
    pageOn: boolean;
    setPageOn: (pageOn: boolean) => void;
    resultMessage?: string;
    successCount?: number;
    failCount?: number;
    totalCount?: number;
    onClose?: () => void;
}

export const LinkPaymentApplySuccessPage = ({
    pageOn,
    setPageOn,
    resultMessage,
    successCount,
    failCount,
    totalCount,
    onClose
}: LinkPaymentApplySuccessPageProps) => {

    const onClickToClose = () => {
        setPageOn(false);
        if (onClose) {
            onClose();
        }
    };

    return (
        <>
            <motion.div
                className="full-menu-modal"
                initial="hidden"
                animate={(pageOn) ? 'visible' : 'hidden'}
                variants={FilterMotionVariants}
                transition={FilterMotionDuration}
                style={{ ...FilterMotionStyle, overflow: 'hidden' }}
            >
                <div className="full-menu-container" style={{ paddingTop: '0px' }}>
                    <div className="success-page">
                        <div className="success-body">
                            <div
                                className="success-icon"
                                aria-hidden="true"
                            ></div>
                            <h1 className="success-title">
                                <span>링크결제_분리승인</span>
                            </h1>

                            <div className="success-result">
                                <p className="result-text align-left position_label">
                                    <span>결과 :</span>
                                    <span>{resultMessage || '전체요청 성공했습니다.'}</span>
                                </p>
                            </div>
                        </div>
                        <div className="apply-row">
                            <button
                                className="btn-50 btn-blue flex-1"
                                onClick={onClickToClose}
                            >확인</button>
                        </div>
                    </div>
                </div>
            </motion.div>
        </>
    );
};