<?php

namespace apexl\Io\modules\display\components;

use apexl\Io\modules\component\Component\Component;

readonly class ImageTile extends Component
{
    private const string PROP__TITLE = 'title';
    private const string PROP__SRC = 'imgSrc';
    private const string PROP__HREF = 'href';

    public function init(string $src = '', string $title = '', string $route = ''): void
    {
        if ($src) {
            $this->src($src);
        }
        if ($title) {
            $this->title($title);
        }
        if ($route) {
            $this->route($route);
        }
    }

    public function src(string $imgSrc): ImageTile
    {
        return $this->setProperty(self::PROP__SRC, $imgSrc);
    }

    public function title(string $title): ImageTile
    {
        return $this->setProperty(self::PROP__TITLE, $title);
    }

    public function route(string $route): ImageTile
    {
        return $this->setProperty(self::PROP__HREF, $route);
    }
}
