<?php
/**
 * BookiFlex Onboarding Extension
 *
 * @package    BookiFlex
 * @subpackage Onboarding
 * @author     BookiFlex
 * @copyright  Copyright (c) 2025 BookiFlex
 * @license    GPL-2.0-or-later
 *
 * @link       https://bookiflex.com
 */

declare(strict_types=1);

namespace BookiFlex\Extensions\Onboarding\ValueObject;

defined( 'ABSPATH' ) || exit;

/**
 * Next Step Value Object
 *
 * Represents a single next step recommendation with title, description, and icon.
 *
 * @package BookiFlex\Extensions\Onboarding\ValueObject
 * @since   1.0.0
 */
class NextStep
{
    /**
     * Next Step constructor
     *
     * @param string $title       Step title (e.g., "Add photos")
     * @param string $description Step description
     * @param string $icon        Emoji icon (e.g., 📸,
     *                            📅, 💰)
     *
     * @throws \InvalidArgumentException If any field is empty
     */
    public function __construct(
        public readonly string $title,
        public readonly string $description,
        public readonly string $icon,
    ) {
        if (empty($this->title) || empty($this->description) || empty($this->icon)) {
            throw new \InvalidArgumentException('All NextStep fields are required');
        }
    }

    /**
     * Convert to array representation
     *
     * @return array{title: string, description: string, icon: string}
     */
    public function toArray(): array
    {
        return [
            'title' => $this->title,
            'description' => $this->description,
            'icon' => $this->icon,
        ];
    }
}
