﻿using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.FileProviders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MediaCloudServer
{
    public class MediaServerTopFolder
    {
        public MediaServerTopFolder(MediaFolder folder)
        {
            if (folder == null) throw new ArgumentNullException(nameof(folder));
            FolderName = folder.Name;
            FolderPath = new PathString("/" + folder.Name);
            FileProvider = new PhysicalFileProvider(folder.Path);
        }

        public MediaServerTopFolder(List<MediaUrl> urls)
        {
            if (urls == null) throw new ArgumentNullException(nameof(urls));
            FolderName = ConstValues.UrlsPathName;
            FolderPath = new PathString("/" + ConstValues.UrlsPathName);
            FileProvider = new MediaUrlListFileProvider(urls);
        }

        public string FolderName { get; private set; }
        public PathString FolderPath { get; private set; }
        public IFileProvider FileProvider { get; private set; }
    }
}
