import { Router } from 'express';
import { EcosystemController } from '../controllers/ecosystem.controller';
import { authenticate, requireRole } from '../middleware/auth.middleware';
import { upload } from '../middleware/upload.middleware';

const router = Router();
const controller = new EcosystemController();

router.get('/offerings', authenticate, controller.listOfferings);
router.post('/offerings', authenticate, requireRole('ADMIN'), controller.createOffering);
router.put('/offerings/:id', authenticate, requireRole('ADMIN'), controller.updateOffering);
router.delete('/offerings/:id', authenticate, requireRole('ADMIN'), controller.deleteOffering);
router.post('/upload', authenticate, requireRole('ADMIN'), upload.single('file'), controller.uploadFile);

// Content Showcase (YouTube Videos)
router.get('/showcase', authenticate, controller.listShowcaseContent);
router.get('/video-meta', authenticate, requireRole('ADMIN'), controller.getYoutubeMeta);
router.post('/showcase', authenticate, requireRole('ADMIN'), controller.createShowcaseContent);
router.put('/showcase/:id', authenticate, requireRole('ADMIN'), controller.updateShowcaseContent);
router.delete('/showcase/:id', authenticate, requireRole('ADMIN'), controller.deleteShowcaseContent);

export default router;
