<?php

namespace Tests;

use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication, RefreshDatabase;

    protected function createUser(array $attributes = []): User
    {
        return User::factory()->withWallet()->create($attributes);
    }

    protected function createAdmin(array $attributes = []): User
    {
        return User::factory()->admin()->withWallet()->create($attributes);
    }

    protected function actingAsUser(): User
    {
        $user = $this->createUser();
        $this->actingAs($user);
        return $user;
    }

    protected function actingAsAdmin(): User
    {
        $admin = $this->createAdmin();
        $this->actingAs($admin);
        return $admin;
    }
}
