<?php
declare(strict_types=1);

namespace PpPhp\Core\Designer\Dashboard;

final class DesignerDashboardChart extends DesignerDashboardWidget
{
    public static function chart(string $id, string $title, string $chartType = 'bar', int $span = 6, array $props = []): self
    {
        $chartType = in_array($chartType, ['line', 'bar', 'pie', 'donut', 'area'], true) ? $chartType : 'bar';

        return new self($id, 'chart', $title, array_replace([
            'chartType' => $chartType,
            'series' => [],
            'labels' => [],
            'height' => 260,
        ], $props), $span);
    }
}
