<?php
/**
 * Bricks storage keys and index area labels.
 *
 * @package LolaCoreForBricks
 */

declare(strict_types=1);

namespace LolaCoreForBricks\Support;

/**
 * Central map of Bricks meta keys and index areas (no Bricks\* runtime calls).
 */
final class BricksMetaKeys
{
    public const PAGE_CONTENT = '_bricks_page_content_2';
    public const PAGE_HEADER  = '_bricks_page_header_2';
    public const PAGE_FOOTER  = '_bricks_page_footer_2';
    public const PAGE_SETTINGS = '_bricks_page_settings';
    public const TEMPLATE_SETTINGS = '_bricks_template_settings';
    public const TEMPLATE_TYPE     = '_bricks_template_type';
    public const TEMPLATE_POST_TYPE = 'bricks_template';

    public const OPTION_GLOBAL_CLASSES   = 'bricks_global_classes';
    public const OPTION_GLOBAL_VARIABLES = 'bricks_global_variables';
    public const OPTION_THEME_STYLES     = 'bricks_theme_styles';
    public const OPTION_COMPONENTS       = 'bricks_components';
    public const OPTION_GLOBAL_ELEMENTS  = 'bricks_global_elements';
    public const OPTION_CLASS_TIMESTAMP  = 'bricks_global_classes_timestamp';

    public const AREA_CONTENT        = 'content';
    public const AREA_HEADER         = 'header';
    public const AREA_FOOTER         = 'footer';
    public const AREA_GLOBAL_ELEMENT = 'global_element';
    public const AREA_CLASS_SETTINGS = 'class_settings';
    public const AREA_THEME_STYLE    = 'theme_style';
    public const AREA_PAGE_SETTINGS  = 'page_settings';

    public const REF_CLASS      = 'class';
    public const REF_VARIABLE   = 'variable';
    public const REF_COMPONENT  = 'component';
    public const REF_ELEMENT    = 'element';

    /**
     * @return array<string, string>
     */
    public static function pageMetaKeyToArea(): array
    {
        return [
            self::PAGE_CONTENT => self::AREA_CONTENT,
            self::PAGE_HEADER  => self::AREA_HEADER,
            self::PAGE_FOOTER  => self::AREA_FOOTER,
        ];
    }

    /**
     * @return string[]
     */
    public static function pageMetaKeys(): array
    {
        return array_keys(self::pageMetaKeyToArea());
    }

    /**
     * @return string[]
     */
    public static function globalOptionHooks(): array
    {
        return [
            self::OPTION_GLOBAL_CLASSES,
            self::OPTION_GLOBAL_VARIABLES,
            self::OPTION_THEME_STYLES,
            self::OPTION_COMPONENTS,
            self::OPTION_GLOBAL_ELEMENTS,
        ];
    }
}
