<?php

namespace App\Services\Tutorials;

class VideoUrlService
{
    /**
     * Construye la URL completa del vídeo según la plataforma
     *
     * @param string $platform Plataforma (youtube, vimeo)
     * @param string $videoId ID del vídeo
     * @return string URL completa del vídeo
     */
    public static function buildUrl(string $platform, string $videoId): string
    {
        return match ($platform) {
            'youtube' => "https://www.youtube.com/watch?v={$videoId}",
            'vimeo' => "https://vimeo.com/{$videoId}",
            default => throw new \InvalidArgumentException("Plataforma no soportada: {$platform}"),
        };
    }

    /**
     * Construye la URL de embed para iframe según la plataforma
     *
     * @param string $platform Plataforma (youtube, vimeo)
     * @param string $videoId ID del vídeo
     * @return string URL de embed para iframe
     */
    public static function buildEmbedUrl(string $platform, string $videoId): string
    {
        return match ($platform) {
            'youtube' => "https://www.youtube.com/embed/{$videoId}",
            'vimeo' => "https://player.vimeo.com/video/{$videoId}",
            default => throw new \InvalidArgumentException("Plataforma no soportada: {$platform}"),
        };
    }
}








