<?php

namespace Database\Factories;

use App\Models\IntegrationWebhookEvent;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\IntegrationWebhookEvent>
 */
class IntegrationWebhookEventFactory extends Factory
{
    protected $model = IntegrationWebhookEvent::class;

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $receivedAt = $this->faker->dateTimeBetween('-2 days', 'now');
        $processedAt = (clone $receivedAt)->modify('+2 minutes');

        return [
            'provider' => $this->faker->randomElement(['paddle', 'revenuecat']),
            'event_id' => $this->faker->uuid(),
            'event_type' => $this->faker->word(),
            'status' => IntegrationWebhookEvent::STATUS_PROCESSED,
            'received_at' => $receivedAt,
            'processed_at' => $processedAt,
            'failed_at' => null,
            'error_message' => null,
            'context' => [],
        ];
    }
}
