<?php

namespace Technical\Integrations\Database\Factories;

use Functional\Users\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Technical\Integrations\Models\ExternalActivity;
use Technical\Integrations\Models\Integration;

/**
 * @extends Factory<ExternalActivity>
 */
class ExternalActivityFactory extends Factory
{
    protected $model = ExternalActivity::class;

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $integration = Integration::factory()->create();

        return [
            'integration_id' => $integration,
            'user_id' => $integration->user_id,
            'provider' => $integration->provider,
            'external_id' => (string) fake()->unique()->numberBetween(1000000, 9999999),
            'type' => fake()->randomElement(['run', 'ride', 'swim', 'walk', 'workout']),
            'started_at' => fake()->dateTimeBetween('-3 months', 'now'),
            'duration_seconds' => fake()->numberBetween(600, 7200),
            'distance_meters' => fake()->optional(0.8)->randomFloat(2, 500, 42000),
            'calories' => fake()->optional(0.8)->numberBetween(100, 2000),
            'raw' => null,
        ];
    }
}
