using System;
using System.Threading.Tasks;
using System.IO;
using Aurora.Proto;
using Aurora.Models;

namespace Aurora.RemoteImpl
{
    public class RemotePlaybackServiceImpl : RemotePlaybackService.RemotePlaybackServiceBase
    {

        public RemotePlaybackServiceImpl()
        {

        }

        public override async Task GetPartyStream(Empty empty,
            Grpc.Core.IServerStreamWriter<Chunk> responseStream,
            Grpc.Core.ServerCallContext context)
        {
            throw new NotImplementedException("Working on it");
            // //Send stream
            // string cwd = Directory.GetCurrentDirectory();
            // using (FileStream fs = System.IO.File.OpenRead(Path.Combine(cwd, request.FileName)))
            // {
            //     Console.WriteLine("Begin sending file");
            //     byte[] buffer = new byte[2048]; // read in chunks of 2KB
            //     int bytesRead;
            //     while ((bytesRead = fs.Read(buffer, 0, buffer.Length)) > 0)
            //     {
            //         Google.Protobuf.ByteString bufferByteString = Google.Protobuf.ByteString.CopyFrom(buffer);
            //         await responseStream.WriteAsync(new Chunk { Content = bufferByteString });
            //     }
            //     Console.WriteLine("Done sending file");
            // };
        }
    }
}