<?php

namespace App\Domains\Bio\Actions;

use App\Domains\Bio\Models\BioPage;
use App\Models\User;

class CreateBioPage
{
    /** @param array<string, mixed> $data */
    public function handle(int $workspaceId, array $data, User $creator): BioPage
    {
        return BioPage::create([
            'workspace_id' => $workspaceId,
            'slug' => $data['slug'],
            'title' => $data['title'] ?? [],
            'description' => $data['description'] ?? [],
            'theme' => $data['theme'] ?? [],
            'is_published' => $data['is_published'] ?? false,
            'domain_id' => $data['domain_id'] ?? null,
        ]);
    }
}
