import express from 'express';
import {
  getAllAlbums,
  getAlbumById,
  createAlbum,
  updateAlbum,
  deleteAlbum,
  reorderAlbums
} from '../controllers/albumController.js';
import { authenticate } from '../middleware/auth.js';

const router = express.Router();

// GET /api/albums - Get all albums (with optional filters) - PUBLIC
router.get('/', getAllAlbums);

// GET /api/albums/:id - Get single album - PUBLIC
router.get('/:id', getAlbumById);

// POST /api/albums - Create new album - PROTECTED
router.post('/', authenticate, createAlbum);

// PUT /api/albums/:id - Update album - PROTECTED
router.put('/:id', authenticate, updateAlbum);

// DELETE /api/albums/:id - Delete album - PROTECTED
router.delete('/:id', authenticate, deleteAlbum);

// PUT /api/albums/:id/reorder - Reorder single album - PROTECTED
router.put('/:id/reorder', authenticate, reorderAlbums);

export default router;
