import express from 'express';
import { authenticate } from '../middleware/authMiddleware.js';
import { 
    getClubTeams, 
    getClubTeam, 
    createClubTeam, 
    updateClubTeam, 
    deleteClubTeam, 
    getLeagues,
    getClubTeamLineup,
    updateClubTeamLineup
} from '../controllers/clubTeamController.js';

const router = express.Router();

// Get all club teams for a club
router.get('/club/:clubid', authenticate, getClubTeams);

// Create a new club team
router.post('/club/:clubid', authenticate, createClubTeam);

// Get leagues for a club
router.get('/leagues/:clubid', authenticate, getLeagues);

// Get a specific club team
router.get('/:clubteamid', authenticate, getClubTeam);

// Get/save lineup for a specific club team
router.get('/:clubteamid/lineup', authenticate, getClubTeamLineup);
router.put('/:clubteamid/lineup', authenticate, updateClubTeamLineup);

// Update a club team
router.put('/:clubteamid', authenticate, updateClubTeam);

// Delete a club team
router.delete('/:clubteamid', authenticate, deleteClubTeam);

export default router;
