<?php

namespace Tests\Feature\Auth;

use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class TenantAdminEntryTest extends TestCase
{
    use RefreshDatabase;

    public function test_guest_is_redirected_to_admin_start(): void
    {
        $response = $this->get('/event-admin/dashboard');

        $response->assertRedirect('/event-admin/start');
    }

    public function test_tenant_admin_can_access_admin_shell(): void
    {
        $user = User::factory()->create([
            'role' => 'tenant_admin',
        ]);

        $response = $this->actingAs($user)->get('/event-admin/dashboard');

        $response->assertOk();
        $response->assertViewIs('admin');
        $response->assertSee('viewport-fit=cover', false);
    }

    public function test_regular_user_is_redirected_to_packages(): void
    {
        $user = User::factory()->create([
            'role' => 'user',
        ]);

        $response = $this->actingAs($user)->get('/event-admin/dashboard');

        $response->assertRedirect('/packages');
    }
}
