<?php

namespace Tests\Unit;

use App\Models\AdminActivityLog;
use PHPUnit\Framework\TestCase;

class AdminActivityLogTest extends TestCase
{
    public function test_it_logs_state_changing_requests(): void
    {
        $this->assertTrue(AdminActivityLog::shouldLogRequest('POST', 'admin.activation_requests.manual_status', '/admin/activation-requests/manual-status'));
        $this->assertTrue(AdminActivityLog::shouldLogRequest('PATCH', 'admin.users.update', '/admin/users/1'));
        $this->assertTrue(AdminActivityLog::shouldLogRequest('DELETE', 'admin.products.destroy', '/admin/products/1'));
    }

    public function test_it_skips_plain_navigation_requests(): void
    {
        $this->assertFalse(AdminActivityLog::shouldLogRequest('GET', 'admin.dashboard', '/admin/dashboard'));
        $this->assertFalse(AdminActivityLog::shouldLogRequest('GET', 'admin.activation_requests.index', '/admin/activation-requests'));
        $this->assertFalse(AdminActivityLog::shouldLogRequest('GET', 'admin.activity-lock.index', '/admin/activity-lock'));
    }

    public function test_it_keeps_logging_explicit_get_actions(): void
    {
        $this->assertTrue(AdminActivityLog::shouldLogRequest('GET', 'admin.gmail.setting.toggle', '/admin/gmail-setting-toggle'));
        $this->assertTrue(AdminActivityLog::shouldLogRequest('GET', 'admin.fb.submissions.change-status', '/admin/fb/submission/1/status/approved'));
        $this->assertTrue(AdminActivityLog::shouldLogRequest('GET', 'admin.users.login', '/admin/users/10/login'));
        $this->assertTrue(AdminActivityLog::shouldLogRequest('GET', 'admin.finance.export', '/admin/finance/export'));
    }
}
