<?php

use App\Http\Controllers\StripeWebhookController;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;

Route::get('/', function () {
    return Inertia::render('Welcome');
})->name('home');

Route::get('dashboard', function () {
    // return Inertia::render('Dashboard');
    // redirect
    return redirect()->route('profile.edit');
})->middleware(['auth', 'verified'])->name('dashboard');

// Replaces Cashier's own `stripe/webhook` route, which AppServiceProvider disables via
// Cashier::ignoreRoutes(). No auth middleware: Stripe authenticates itself with the
// signature header (STRIPE_WEBHOOK_SECRET), and `stripe/*` is excluded from CSRF.
Route::post('stripe/webhook', [StripeWebhookController::class, 'handleWebhook'])
    ->name('cashier.webhook');

require __DIR__.'/settings.php';
require __DIR__.'/auth.php';
