<?php

namespace KupShop\ComponentsBundle\Twig\Components\Page;

use KupShop\ComponentsBundle\Attributes\Component;
use KupShop\ComponentsBundle\Attributes\Version;
use KupShop\ComponentsBundle\Entity\Thumbnail;
use KupShop\ComponentsBundle\Twig\BaseComponent;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;

#[AsTwigComponent(template: '@Components/components/Page/ImageTitle/ImageTitle.1.html.twig')]
#[Component(1, [
    new Version(1, newJs: null),
])]
class ImageTitle extends BaseComponent
{
    public string $title = '';
    public string $className = '';
    public array $image = [];
    public string $container = 'container';

    public function getThumbnail(): ?Thumbnail
    {
        return !empty($this->image) ? new Thumbnail($this->image['id'], $this->image['descr'], (string) $this->image['date_update']) : null;
    }
}
