<?php
declare(strict_types=1);

namespace PpPhp\Core\Designer\Visual;

final class DesignerCanvasRuntime
{
    public function clean(array $page, string $mode = 'normal'): array
    {
        return [
            'mode' => $mode,
            'showStructure' => $mode === 'layout',
            'showEmptySlots' => $mode === 'layout',
            'showGuides' => $mode === 'layout',
            'componentBorders' => $mode === 'layout' ? 'structure' : 'minimal',
            'page' => $page,
            'classes' => ['designer-canvas', 'designer-canvas-mode-' . $mode, $mode === 'layout' ? 'designer-show-structure' : 'designer-hide-structure'],
        ];
    }

    public function previewRules(): array
    {
        return [
            'normal' => ['rowBorders' => false, 'columnBorders' => false, 'emptySlots' => false, 'dropZones' => false],
            'layout' => ['rowBorders' => true, 'columnBorders' => true, 'emptySlots' => true, 'dropZones' => true],
            'selection' => ['selectedOnly' => true, 'emptySlots' => false],
        ];
    }
}
