<?php

namespace Tests\Feature;

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

class AdminPlatformOrderCreateRequireSubscriptionFlagShouldOnlyShowNewPurchaseTypeTest 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_create_should_only_show_new_purchase_when_require_subscription_flag_and_no_subscription_context(): void
    {
        $this->loginAsPlatformAdmin();

        $res = $this->get('/admin/platform-orders/create?require_subscription=1');
        $res->assertOk();

        // 仅保留 new_purchase 作为可选项（避免误用 upgrade/downgrade 等）
        $res->assertSee('value="new_purchase"', false);
        $res->assertDontSee('value="upgrade"', false);
        $res->assertDontSee('value="downgrade"', false);
    }
}
