/**
 * Todo Routes
 * Todo API endpoints with three-state workflow
 */

import { Router } from 'express';
import { TodoController } from '../controllers/todo.controller';
import { authenticate } from '../middleware/auth.middleware';

const router = Router();

/**
 * @route   POST /api/todos
 * @desc    Create a new todo
 * @access  Private
 */
router.post('/', authenticate, TodoController.create);

/**
 * @route   GET /api/todos
 * @desc    Get user todos
 * @access  Private
 */
router.get('/', authenticate, TodoController.getUserTodos);

/**
 * @route   GET /api/todos/pending
 * @desc    Get pending todos
 * @access  Private
 */
router.get('/pending', authenticate, TodoController.getPending);

/**
 * @route   GET /api/todos/completed
 * @desc    Get completed todos
 * @access  Private
 */
router.get('/completed', authenticate, TodoController.getCompleted);

/**
 * @route   GET /api/todos/confirmed
 * @desc    Get confirmed todos
 * @access  Private
 */
router.get('/confirmed', authenticate, TodoController.getConfirmed);

/**
 * @route   GET /api/todos/:id
 * @desc    Get todo by ID
 * @access  Private
 */
router.get('/:id', authenticate, TodoController.getById);

/**
 * @route   PUT /api/todos/:id
 * @desc    Update todo
 * @access  Private
 */
router.put('/:id', authenticate, TodoController.update);

/**
 * @route   DELETE /api/todos/:id
 * @desc    Delete todo
 * @access  Private
 */
router.delete('/:id', authenticate, TodoController.delete);

export default router;
