using System;
using System.IO;

namespace ExtensiblePortfolioSite.SDK.Resources.VFS
{
    internal class VirtualFile : IVirtualFile
    {
        public IVirtualFolder Folder { get; }
        public string Filename { get; }

        public IResource ResourceContainer { get; }

        internal VirtualFile(IVirtualFolder Folder, string Filename, IResource ResourceContainer)
        {
            this.Folder = Folder;
            this.Filename = Filename;
            this.ResourceContainer = ResourceContainer;
        }

        public void Delete() => Folder.Delete(Filename);
        public Stream OpenStream() => ResourceContainer.OpenStream();
    }
}
