<?php

namespace Tests\Feature;

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

class IdCardPrintTest extends TestCase
{
    use RefreshDatabase;

    protected function setUp(): void
    {
        parent::setUp();

        Role::create(['name' => 'super_admin', 'label' => 'Super Admin']);
        Role::create(['name' => 'siswa', 'label' => 'Siswa']);

        $this->admin = User::factory()->create([
            'role_id' => 1,
            'email' => 'admin@school.test',
            'force_password_change' => false,
        ]);
    }

    public function test_can_render_id_card_page(): void
    {
        $this->actingAs($this->admin);

        $response = $this->get(route('personnel.id-cards'));
        $response->assertStatus(200);
        $response->assertSee('Cetak ID Card Siswa');
    }

    public function test_can_render_print_layout(): void
    {
        $this->actingAs($this->admin);

        $response = $this->get(route('personnel.id-cards.print'));
        $response->assertStatus(200);
        $response->assertSee('Cetak Seluruh Kartu Siswa');
    }
}
