<?php

namespace KupShop\ComponentsBundle\Twig\Components;

use KupShop\ComponentsBundle\Attributes\Blocek;
use KupShop\ComponentsBundle\Attributes\BlocekAttribute;
use KupShop\ComponentsBundle\Attributes\Component;
use KupShop\ComponentsBundle\Attributes\Version;
use KupShop\ComponentsBundle\Twig\BaseComponent;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;

#[AsTwigComponent(template: '@Components/components/SocialIcons/SocialIcons.1.html.twig')]
#[Component(1, [
    new Version(1, newJs: null),
])]
#[Blocek(title: 'Sociální sítě')]
class SocialIcons extends BaseComponent
{
    #[BlocekAttribute(title: 'Originální barva ikonek')]
    public bool $icon_nofill = false;

    public function getSocialIcons(): array
    {
        $icons = [];
        $dbcfg = \Settings::getDefault();

        foreach ($dbcfg->social as $icon => $link) {
            if ($link) {
                $icons[$icon] = $link;
            }
        }

        return $icons;
    }
}
