<?php

namespace Database\Factories;

use App\Models\Wallet;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

class WalletFactory extends Factory
{
    protected $model = Wallet::class;

    public function definition(): array
    {
        return [
            'user_id' => User::factory(),
            'balance' => fake()->randomFloat(2, 0, 100000),
            'total_funded' => fake()->randomFloat(2, 0, 500000),
            'total_spent' => fake()->randomFloat(2, 0, 200000),
            'status' => 'active',
        ];
    }

    public function empty(): static
    {
        return $this->state(fn (array $attributes) => [
            'balance' => 0,
            'total_funded' => 0,
            'total_spent' => 0,
        ]);
    }

    public function funded(float $amount = 10000): static
    {
        return $this->state(fn (array $attributes) => [
            'balance' => $amount,
            'total_funded' => $amount,
        ]);
    }
}
