<?php

declare(strict_types=1);

namespace App\Settings;

use App\Domain\Theme\ThemeSlot;
use Spatie\LaravelSettings\Settings;

class SnippetSettings extends Settings
{
    /** Analytics / tags in <head> */
    public string $analytics_head;

    /** Extra HTML/JS before </body> */
    public string $body_end;

    /** Ad / promo HTML in sidebar */
    public string $ads_sidebar;

    /** Ad above article body */
    public string $ads_article_top;

    /** Ad below article body */
    public string $ads_article_bottom;

    /** Free HTML after header / before main */
    public string $header_banner;

    /** Temporary links / notices in sidebar (HTML allowed) */
    public string $custom_links_html;

    /** Footer free HTML */
    public string $footer_html;

    public static function group(): string
    {
        return 'snippets';
    }

    /**
     * Map settings fields → ThemeSlot names.
     *
     * @return array<string, string>
     */
    public function slotMap(): array
    {
        return [
            ThemeSlot::HEAD => $this->analytics_head,
            ThemeSlot::BODY_END => $this->body_end,
            ThemeSlot::SIDEBAR => $this->ads_sidebar,
            ThemeSlot::ARTICLE_TOP => $this->ads_article_top,
            ThemeSlot::ARTICLE_BOTTOM => $this->ads_article_bottom,
            ThemeSlot::HEADER_AFTER => $this->header_banner,
            ThemeSlot::SIDEBAR_AFTER => $this->custom_links_html,
            ThemeSlot::FOOTER_BEFORE => $this->footer_html,
        ];
    }
}
