<?php

use App\Http\Controllers\Announcements\AssignAnnouncementToSegmentController;
use App\Http\Controllers\Announcements\CreateAnnouncementController;
use App\Http\Controllers\Announcements\DeleteAnnouncementController;
use App\Http\Controllers\Announcements\ListAnnouncementsController;
use App\Http\Controllers\Announcements\RemoveSegmentFromAnnouncementController;
use App\Http\Controllers\Announcements\UpdateAnnouncementController;
use Illuminate\Support\Facades\Route;

Route::group(['prefix' => 'announcement', 'as' => 'announcement.'], function () {
    Route::get('/list', [ListAnnouncementsController::class, 'list'])->name('list');
    Route::post('/create', [CreateAnnouncementController::class, 'create'])->name('create');
    Route::put('/update/{id}', [UpdateAnnouncementController::class, 'update'])->name('update');
    Route::delete('/delete/{id}', [DeleteAnnouncementController::class, 'delete'])->name('delete');

    Route::group(['prefix' => '{id}/segment', 'as' => 'segment.'], function () {
        Route::post('/assign', [AssignAnnouncementToSegmentController::class, 'assign'])->name('assign');
        Route::delete('/detach/{segment_id}', [RemoveSegmentFromAnnouncementController::class, 'detach'])->name('detach');
    });
});