<?php


namespace Mehrab\Media\Services;


use Illuminate\Support\Facades\Storage;
use Mehrab\Media\Contracts\MediaServiceContract;
use Mehrab\Media\Models\Media;

class VideoUploadService extends DefaultFileService implements MediaServiceContract
{
    public static function upload($file,$fileName,$dir) : array {

        $extension = strtolower($file->getClientOriginalExtension());
        Storage::putFileAs($dir,$file,$fileName.'.',$extension);
        return ["video"=>$fileName.'.'.$extension];
    }

    public static function getFileName(){
        return (static::$media->is_private ? 'app\\private\\' : 'app\\public\\') . self::$media->files['video'];
    }

    public static function thumb(Media $media)
    {
        return url('img/logo/test.png');
    }
}
