<?php

namespace KupShop\ComponentsBundle\Twig\Components;

use KupShop\CDNBundle\CDN;
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/Video/Video.1.html.twig')]
#[Component(1, [
    new Version(1, newJs: null),
])]
class Video extends BaseComponent
{
    public string $id_video;

    public string $resolution = '720p';

    public function __construct(
        protected CDN $cdn,
    ) {
    }

    public function getMp4(): string
    {
        return $this->cdn->getMP4Video($this->id_video, $this->resolution);
    }

    public function getHls(): string
    {
        return $this->cdn->getHLSPlaylist($this->id_video);
    }
}
