<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AdminPlatformOrderIndexGovernanceBlocksUseCssComponentTest extends TestCase
{
    use RefreshDatabase;

    protected function loginAsPlatformAdmin(): void
    {
        $this->seed();

        $this->post('/admin/login', [
            'email' => 'platform.admin@demo.local',
            'password' => 'Platform@123456',
        ])->assertRedirect('/admin');
    }

    public function test_index_should_render_governance_blocks_with_css_component_class_when_filters_present(): void
    {
        $this->loginAsPlatformAdmin();

        $res = $this->get('/admin/platform-orders?reconcile_mismatch=1&syncable_only=1&sync_status=failed&bmpa_failed_only=1');
        $res->assertOk();

        // 只要命中任一治理提示，页面应使用治理组件 class（避免再次写回 inline style）
        $res->assertSee('governance-block', false);
        $res->assertSee('governance-block-title', false);
        $res->assertSee('governance-block-body', false);

        $res->assertSee('工具动作治理提示', false);
        $res->assertSee('同步失败治理提示', false);
        $res->assertSee('BMPA 失败治理提示', false);
    }
}
