import { Upload }           from './../models/upload/upload.model';
import { SUPController }    from './sup.server.controller';
const yellow                = '\x1b[33m%s\x1b[0m: ';

export class SUP {
    constructor(private io: SocketIOClient.Manager) { }
    registerIO() {
        this.io.on('connection', (socket: SocketIOClient.Socket) => {
        console.log(yellow, 'Socket connected!');
      socket.on('NextChunk', (data) => {
        console.log(yellow, 'Receiving data.');
        SUPController.nextChunk(data, socket);
      });
        socket.on('NextFile', (data) => {
          console.log(yellow, 'Receiving next File.');
          SUPController.nextFile(data, socket);
        });
      });
    }

    static handshake(data, cb): void {
        SUPController.handshake(data, cb);
    }
    static pause(data, cb): void {
        SUPController.pause(data, cb);
    }
    static continue(data, cb): void {
        SUPController.continue(data, cb);
    }
    static abort(data, cb): void {
        SUPController.abort(data, cb);
    }
}
