import express from 'express';
import {
  createTreelogy as createProject,
  listTreelogies as listProjects,
  getTreelogyById as getProjectById,
  updateTreelogy as updateProject,
  deleteTreelogy as deleteProject
} from '../controllers/treelogyController.js';
import { requireAuth, requireRole } from '../middleware/auth.js';

const router = express.Router();
router.post('/', requireAuth, requireRole('SUPER_ADMIN', 'CLIENT_ADMIN'), createProject);
router.get('/', requireAuth, listProjects);
router.get('/:id', requireAuth, getProjectById);
router.put('/:id', requireAuth, requireRole('SUPER_ADMIN', 'CLIENT_ADMIN'), updateProject);
router.delete('/:id', requireAuth, requireRole('SUPER_ADMIN'), deleteProject);

export default router;