<?php

use Illuminate\Support\Facades\Route;
use Modules\Activity\Http\Controllers\ActivityController;
use Modules\Activity\Http\Controllers\ActivityReportController;
use Modules\Activity\Http\Controllers\ActivityTypeController;

Route::middleware(['auth:sanctum', 'single.session'])->prefix('v1')->group(function () {
    Route::apiResource('activity-types', ActivityTypeController::class)->names('activity-type');
    Route::apiResource('activities', ActivityController::class)->names('activity');

    // gallery images
    Route::post('activities/{activity}/gallery', [ActivityController::class, 'uploadGalleryImage'])->name('activity.upload-gallery-image');
    Route::get('activities/{activity}/gallery/{imageId}', [ActivityController::class, 'serveGalleryImage'])->name('activity.serve-gallery-image');
    Route::delete('activities/{activity}/gallery/{imageId}', [ActivityController::class, 'deleteGalleryImage'])->name('activity.delete-gallery-image');

    // documents
    Route::post('activities/{activity}/documents', [ActivityController::class, 'uploadDocument'])->name('activity.upload-document');
    Route::get('activities/{activity}/documents/{documentId}/download', [ActivityController::class, 'downloadDocument'])->name('activity.download-document');
    Route::delete('activities/{activity}/documents/{documentId}', [ActivityController::class, 'deleteDocument'])->name('activity.delete-document');

    // reports
    Route::apiResource('activity-reports', ActivityReportController::class)->names('activity-report');
});
