using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Kyoo.Models;
using Microsoft.AspNetCore.Mvc;
namespace Kyoo.Controllers
{
	/// 
	/// A service to abstract the file system to allow custom file systems (like distant file systems or external providers)
	/// 
	public interface IFileManager
	{
		// TODO find a way to handle Transmux/Transcode with this system.
		/// 
		/// Used for http queries returning a file. This should be used to return local files
		/// or proxy them from a distant server
		/// 
		/// 
		///	If no file exists at the given path or if the path is null, a NotFoundResult is returned
		/// to handle it gracefully.
		/// 
		/// The path of the file.
		/// 
		/// Should the file be downloaded at once or is the client allowed to request only part of the file
		/// 
		/// 
		/// You can manually specify the content type of your file.
		/// For example you can force a file to be returned as plain text using text/plain.
		/// If the type is not specified, it will be deduced automatically (from the extension or by sniffing the file).
		/// 
		/// An  representing the file returned.
		public IActionResult FileResult([CanBeNull] string path, bool rangeSupport = false, string type = null);
		/// 
		/// Read a file present at . The reader can be used in an arbitrary context.
		/// To return files from an http endpoint, use .
		/// 
		/// The path of the file
		/// If the file could not be found.
		/// A reader to read the file.
		public Stream GetReader([NotNull] string path);
		/// 
		/// Create a new file at .
		/// 
		/// The path of the new file.
		/// A writer to write to the new file.
		public Stream NewFile([NotNull] string path);
		/// 
		/// List files in a directory.
		/// 
		/// The path of the directory
		/// A list of files's path.
		public Task> ListFiles([NotNull] string path);
		/// 
		/// Check if a file exists at the given path.
		/// 
		/// The path to check
		/// True if the path exists, false otherwise
		public Task Exists([NotNull] string path);
		/// 
		/// Get the extra directory of a show.
		/// This method is in this system to allow a filesystem to use a different metadata policy for one.
		/// It can be useful if the filesystem is readonly.
		/// 
		/// The show to proceed
		/// The extra directory of the show
		public string GetExtraDirectory(Show show);
		
		/// 
		/// Get the extra directory of a season.
		/// This method is in this system to allow a filesystem to use a different metadata policy for one.
		/// It can be useful if the filesystem is readonly.
		/// 
		/// The season to proceed
		/// The extra directory of the season
		public string GetExtraDirectory(Season season);
		
		/// 
		/// Get the extra directory of an episode.
		/// This method is in this system to allow a filesystem to use a different metadata policy for one.
		/// It can be useful if the filesystem is readonly.
		/// 
		/// The episode to proceed
		/// The extra directory of the episode
		public string GetExtraDirectory(Episode episode);
	}
}