<?php

namespace ZenoChatbot\Services\Dashboard;

class WidgetBuilder
{
    private string $title;
    private string $value;
    private string $subtitle;
    private string $icon;
    private string $color;
    private int $order;

    public function __construct($title, $value, $subtitle = '', $icon = '', $color = '#2563eb', $order = 1)
    {
        $this->title = $title;
        $this->value = $value;
        $this->subtitle = $subtitle;
        $this->icon = $icon;
        $this->color = $color;
        $this->order = $order;
    }

    public static function build($title, $value, $subtitle = '', $icon = '', $color = '#2563eb', $order = 1)
    {
        return (new static($title, $value, $subtitle, $icon, $color, $order))->toArray();
    }

    public function toArray()
    {
        return [
            'title'    => $this->title,
            'value'    => $this->value,
            'subtitle' => $this->subtitle,
            'icon'     => $this->icon,
            'color'    => $this->color,
            'order'    => $this->order
        ];
    }
}
