<?php

namespace Database\Factories;

use App\Domains\Domain\Models\Domain;
use App\Domains\Workspace\Actions\CreateWorkspace;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

class DomainFactory extends Factory
{
    protected $model = Domain::class;

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

        return [
            'workspace_id' => $workspace->id,
            'hostname' => $this->faker->domainName(),
            'verification_token' => Str::random(32),
            'ssl_status' => 'pending',
            'is_default' => false,
        ];
    }
}
