<?php

use App\Http\Controllers\ServiceController;
use App\Http\Controllers\AuthController; // Copy AuthController dari project lama ya Mas
use Illuminate\Support\Facades\Mail;

//Route::get('/', function () {
//    return redirect('/login');
//});

// Route Service
// 1. Rute utama cuma buat nampilin topeng iframe
Route::get('/', function () {
    return view('pembungkus_utama');
});

Route::get('/service', [ServiceController::class, 'index']);
Route::get('/service/tambah', [ServiceController::class, 'create']);
Route::post('/service/simpan', [ServiceController::class, 'store']);
Route::post('/service/update/{id}', [ServiceController::class, 'updateStatus']);
// Pastikan baris ini ada di web.php
Route::delete('/service/{id}', [ServiceController::class, 'delete']);
Route::patch('/service/{id}/update-status', [ServiceController::class, 'updateStatus']);
// Menampilkan halaman form analisis
Route::get('/service/{id}/analisis', [ServiceController::class, 'analisis']);

// Proses menyimpan hasil ketikan Mas ke database
Route::post('/service/{id}/simpan-analisis', [ServiceController::class, 'simpanAnalisis']);
// Route untuk menampilkan halaman cetak
Route::get('/service/{id}/print', [ServiceController::class, 'cetak']);

Route::get('/service/export', [ServiceController::class, 'exportExcel']);

Route::get('/test-email', function () {

    Mail::raw('Halo Manager, ini email test dari Laravel.', function ($message) {
        $message->to('ilham.arfiansyah@gmail.com')
                ->subject('Test Email Laravel');
    });

    return 'Email terkirim';
});

