import express from 'express';
import { auth } from '../../middleware/auth';
import {
  getAuthors,
  createAuthor,
  updateAuthor,
  deleteAuthor,
  linkAuthorToUser,
  unlinkAuthorFromUser,
  toggleActiveAuthor,
  reorderAuthor
} from './controllers/authors';


const router = express.Router();

router.get('/', getAuthors);
router.post('/', auth, createAuthor);
router.put('/:id', auth, updateAuthor);
router.delete('/:id', auth, deleteAuthor);
router.put('/:id/link-user', auth, linkAuthorToUser);
router.put('/:id/unlink-user', auth, unlinkAuthorFromUser);
router.put('/:id/toggle-active', auth, toggleActiveAuthor);
router.put('/:id/reorder', auth, reorderAuthor);

export default router;