'use client'

import { usePopupController } from '@/store/popupController'

export default function DoubleBtnAlert() {
  const { alertMsg, alert2BtnYes, alert2BtnNo, setAlert2 } = usePopupController()

  const handleAlert2BtnYes = () => {
    alert2BtnYes()
    setAlert2(false)
  }

  const handleAlert2BtnNo = () => {
    alert2BtnNo()
    setAlert2(false)
  }

  return (
    <div className="modal-popup alert">
      <div className="modal-dialog">
        <div className="modal-content">
          <div className="alert-tit">{alertMsg}</div>
          <div className="alert-btn-wrap">
            <div className="alert-btn-bx">
              <button className="btn-frame red min" onClick={() => handleAlert2BtnYes()}>
                確認
              </button>
            </div>
            <div className="alert-btn-bx">
              <button className="btn-frame n-blue min" onClick={() => handleAlert2BtnNo()}>
                キャンセル
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  )
}
