import express from 'express'
import { accountingSetup } from '../controllers/accountingSetupController.js'
import { accountingSearch } from '../controllers/accountingSearchController.js'
import { accountingSum } from '../controllers/accountingSumController.js'
import { accountingAdd } from '../controllers/accountingAddController.js'
import { reportController } from '../controllers/ReportController.js'

// import { authMiddleware } from '../middlewares/auth.js'
// import { sendResponse } from '../utils/response.js'

const router = express.Router()
const controller_accountingSetup_post = new accountingSetup()
const controller_accountingSearch_post = new accountingSearch()
const controller_accountingSum_post = new accountingSum()
const controller_accountingAdd_post = new accountingAdd()
const controller_report_post = new reportController()

router.post('/accountingsetup', async (req, res) => {
  const result = await controller_accountingSetup_post.onNavigate(req, res)
  if (result) return res.json(result)
})


router.post('/accountingsearch', async (req, res) => {
  const result = await controller_accountingSearch_post.onNavigate(req, res)
  if (result) return res.json(result)
})

router.post('/accountingsum', async (req, res) => {
  const result = await controller_accountingSum_post.onNavigate(req, res)
  if (result) return res.json(result)
})

router.post('/accountingadd', async (req, res) => {
  const result = await controller_accountingAdd_post.onNavigate(req, res)
  if (result) return res.json(result)
})

router.post('/report', async (req, res) => {
  const result = await controller_report_post.onNavigate(req, res)
  if (result) return res.json(result)
})

// // ===================================================
// // 🔹 BIOMETRIC LOGIN
// // ===================================================
// router.post('/biometric/login', async (req, res) => {
//   const data = await controller_login_post.onBiometricLogin(req, res)
//   if (data)
//     return sendResponse(res, 200, 'เข้าสู่ระบบผ่าน Biometric สำเร็จ', 'Biometric login succeed', data)
// })

// // ===================================================
// // 🔹 BIOMETRIC REGISTER (ต้อง login ก่อน)
// // ===================================================
// router.post('/biometric/register', authMiddleware, async (req, res) => {
//   const data = await controller_login_post.onBiometricRegister(req, res)
//   if (data)
//     return sendResponse(res, 200, 'ผูก Biometric สำเร็จ', 'Biometric registered', data)
// })

// // ===================================================
// // 🔹 TOKEN RENEW (ต่ออายุ Token)
// // ===================================================
// router.post('/token/renew', authMiddleware, async (req, res) => {
//   const data = await controller_login_post.onRenewToken(req, res)
//   if (data)
//     return sendResponse(res, 200, 'ออก Token ใหม่สำเร็จ', 'Token renewed', data)
// })

export default router
