'use client'

import { useState } from 'react'
import FirstOption from './FirstOption'
import WithDraggable from '@/components/common/draggable/withDraggable'
import SecondOption from '@/components/floor-plan/modal/setting01/SecondOption'
import { useMessage } from '@/hooks/useMessage'
import GridOption from '@/components/floor-plan/modal/setting01/GridOption'

export default function SettingModal01(props) {
  const { setShowCanvasSettingModal, setShowDotLineGridModal } = props
  const [buttonAct, setButtonAct] = useState(1)
  const { getMessage } = useMessage()

  return (
    <WithDraggable isShow={true} pos={{ x: 50, y: 30 }}>
      <div className={`modal-pop-wrap sm`}>
        <div className="modal-head">
          <h1 className="title">{getMessage('modal.canvas.setting')}</h1>
          <button className="modal-close" onClick={() => setShowCanvasSettingModal(false)}>
            닫기
          </button>
        </div>
        <div className="modal-body">
          <div className="modal-btn-wrap">
            <button className={`btn-frame modal ${buttonAct === 1 ? 'act' : ''}`} onClick={() => setButtonAct(1)}>
              {getMessage('modal.canvas.setting.display')}
            </button>

            <button className={`btn-frame modal ${buttonAct === 2 ? 'act' : ''}`} onClick={() => setButtonAct(2)}>
              {getMessage('modal.canvas.setting.font.plan')}
            </button>
            <button className={`btn-frame modal ${buttonAct === 3 ? 'act' : ''}`} onClick={() => setButtonAct(3)}>
              {getMessage('modal.canvas.setting.grid')}
            </button>
          </div>
          {buttonAct === 1 && <FirstOption />}
          {buttonAct === 2 && <SecondOption />}
          {buttonAct === 3 && <GridOption setShowDotLineGridModal={setShowDotLineGridModal} />}
        </div>
      </div>
    </WithDraggable>
  )
}
