<?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 AnalyticsGridLayout implements DesignerLayoutInterface
{
    public static function id(): string
    {
        return 'analytics_grid';
    }

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

    public static function description(): string
    {
        return 'Two chart areas followed by two insight areas.';
    }

    public static function icon(): string
    {
        return 'bar-chart-line';
    }

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

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

    public static function components(): array
    {
        return [
            C::make('analytics_charts_row', 'row', 'Analytics Charts Row', [
                'columns' => 2,
                'cells' => [
                    self::cell('analytics_chart_left'),
                    self::cell('analytics_chart_right'),
                ],
            ]),

            C::make('analytics_insights_row', 'row', 'Analytics Insights Row', [
                'columns' => 2,
                'cells' => [
                    self::cell('analytics_insight_left'),
                    self::cell('analytics_insight_right'),
                ],
            ]),
        ];
    }

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