<?php

declare(strict_types=1);

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

/** @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Coupon> */
class CouponFactory extends Factory
{
    /** @return array<string, mixed> */
    public function definition(): array
    {
        return [
            'code' => Str::upper(fake()->unique()->bothify('??##??')),
            'type' => fake()->randomElement(['percentage', 'fixed_amount']),
            'value' => fake()->randomFloat(2, 5, 50),
            'max_uses' => fake()->optional()->numberBetween(10, 1000),
            'times_used' => 0,
            'active' => true,
            'expires_at' => fake()->optional()->dateTimeBetween('now', '+1 year'),
        ];
    }
}
