<?php

declare(strict_types=1);

namespace Database\Factories;

use App\Models\SupplierLead;
use App\Models\SupplierProject;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends Factory<SupplierLead>
 */
class SupplierLeadFactory extends Factory
{
    protected $model = SupplierLead::class;

    public function definition(): array
    {
        $platform = $this->faker->randomElement(['B1', 'B2', 'B3']);
        $vid = $this->faker->unique()->numberBetween(100_000_000, 999_999_999);
        $phone = '7'.$this->faker->numerify('##########');

        return [
            'supplier_project_id' => SupplierProject::factory(),
            'platform' => $platform,
            'raw_payload' => [
                'vid' => $vid,
                'project' => $platform.'_test.example.com',
                'tag' => 'test-tag',
                'phone' => $phone,
                'phones' => [$phone],
                'time' => now()->getTimestamp(),
            ],
            'vid' => $vid,
            'phone' => $phone,
            'received_at' => now(),
            'source' => 'webhook',
            'processed_at' => null,
            'deals_created_count' => null,
            'error' => null,
        ];
    }
}
