<?php

namespace Database\Factories;

use App\Domains\Webhook\Models\Webhook;
use App\Domains\Workspace\Actions\CreateWorkspace;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

class WebhookFactory extends Factory
{
    protected $model = Webhook::class;

    public function definition(): array
    {
        $user = User::factory()->create();
        $workspace = (new CreateWorkspace)->handle($user, ['name' => 'Test']);

        return [
            'workspace_id' => $workspace->id,
            'url' => $this->faker->url(),
            'secret' => $this->faker->sha256(),
            'events' => ['click.recorded'],
            'is_active' => true,
        ];
    }
}
