// routes/chartOfAccountsRoutes.js
const express = require("express");
const router = express.Router();
const {
  getChartOfAccounts,
  getChartOfAccountsSummary,
  getAccountById,
  createAccount,
  updateAccount,
  deleteAccount,
  getAccountHierarchy
} = require("../../controllers/accounts/chartOfAccountsController");

// Authentication middleware
const authenticate = require("../../middlewares/authenticate");

// Apply authentication to all routes
router.use(authenticate);

// Routes
router.get("/", getChartOfAccounts);
router.get("/summary", getChartOfAccountsSummary);
router.get("/hierarchy", getAccountHierarchy);
router.get("/:id", getAccountById);
router.post("/", createAccount);
router.put("/:id", updateAccount);
router.delete("/:id", deleteAccount);

module.exports = router;