<?php

/**
 * Media Module — Route Definitions (G004)
 *
 * Registers routes for Media Management: upload, delete, file serve,
 * and the Media Manager page embedded in the Invitation Builder.
 *
 * Injected into the /app/couple group prefix via routes/couple.php
 * through app/modules/Invitation/routes.php.
 *
 * GET  /app/couple/invitation/media          → MediaController@index   (Media Manager)
 * POST /app/couple/invitation/media/upload   → MediaController@upload  (AJAX upload)
 * POST /app/couple/invitation/media/delete   → MediaController@delete  (AJAX delete)
 * GET  /app/couple/media/serve               → MediaController@serve   (File streaming)
 *
 * @package Inveetaire
 * @ref     G004
 */

// ── GET /app/couple/invitation/media — Media Manager page ────────────────────
$router->get('/invitation/media', 'App\\Modules\\Media\\MediaController@index');

// ── POST /app/couple/invitation/media/upload — AJAX file upload ───────────────
$router->post('/invitation/media/upload', 'App\\Modules\\Media\\MediaController@upload', [
    'App\\Middleware\\CsrfMiddleware',
]);

// ── POST /app/couple/invitation/media/delete — AJAX file delete ───────────────
$router->post('/invitation/media/delete', 'App\\Modules\\Media\\MediaController@delete', [
    'App\\Middleware\\CsrfMiddleware',
]);

// ── POST /app/couple/invitation/media/music-settings — AJAX settings save ───────
$router->post('/invitation/media/music-settings', 'App\\Modules\\Media\\MediaController@saveMusicSettings', [
    'App\\Middleware\\CsrfMiddleware',
]);

// ── GET /app/couple/media/serve — Secured private file streaming ─────────────
// Note: No CSRF on GET — auth + workspace ownership validated inside controller
$router->get('/media/serve', 'App\\Modules\\Media\\MediaController@serve');
