<?php

declare(strict_types=1);

namespace PpPhp\Core\Designer\Layouts\Layouts;

use PpPhp\Core\Designer\DesignerComponent as C;
use PpPhp\Core\Designer\Layouts\DesignerLayoutInterface;

class KPIGridLayout implements DesignerLayoutInterface
{
    public static function id(): string
    {
        return 'kpi_grid';
    }

    public static function name(): string
    {
        return 'KPI Grid';
    }

    public static function description(): string
    {
        return 'Four-column KPI/stat widget layout.';
    }

    public static function icon(): string
    {
        return 'grid-3x3-gap';
    }

    public static function category(): string
    {
        return 'Dashboard';
    }

    public static function columns(): int
    {
        return 4;
    }

    public static function components(): array
    {
        return [
            C::make('kpi_grid_row', 'row', 'KPI Grid Row', [
                'columns' => 4,
                'cells' => [
                    self::cell('kpi_cell_1'),
                    self::cell('kpi_cell_2'),
                    self::cell('kpi_cell_3'),
                    self::cell('kpi_cell_4'),
                ],
            ]),
        ];
    }

    private static function cell(string $id): array
    {
        return [
            'id' => $id,
            'span' => 3,
            'components' => [],
            'style' => C::style(),
        ];
    }
}
