<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\CouponUsage>
 */
class CouponUsageFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'coupon_id' => Coupon::factory(),
            'user_id' => \App\Models\User::factory(),
            'subscription_id' => \App\Models\Subscription::factory(),
            'discount_amount' => fake()->randomFloat(2, 5, 50),
            'currency' => 'USD',
            'used_at' => fake()->dateTimeBetween('-3 months', 'now'),
            'metadata' => fake()->optional(0.2)->randomElements([
                'ip_address' => fake()->ipv4(),
                'user_agent' => fake()->userAgent(),
            ]),
        ];
    }
}
