<?php

namespace Tests\Feature\Tenant;

use App\Models\SubscriptionPayment;
use App\Models\User;
use Database\Seeders\DatabaseSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class PaymentsFeatureTest extends TestCase
{
    use RefreshDatabase;

    public function test_company_admin_can_create_pending_subscription_payment(): void
    {
        $this->seed(DatabaseSeeder::class);

        $user = User::where('email', 'admin@barberia-demo.test')->firstOrFail();

        $this->actingAs($user)
            ->post(route('tenant.payments.create-pending'))
            ->assertRedirect();

        $payment = SubscriptionPayment::firstOrFail();

        $this->assertSame('manual', $payment->driver);
        $this->assertSame('pending', $payment->status->value);
    }
}
