import * as Cassandra from "cassandra-driver";
import { EventEmitter } from "events";
import * as Index from "../index.d";

export default class CassandraMock extends EventEmitter implements Cassandra.Client {

    private statusCallback: (err: any) => void;
    public profileManager: any;  
    public controlConnection: any;  
    constructor(options: Index.CassandraOptions, errorCallback: (err: any) => void, successCallback: () => void, callbackStatus: (err: any) => void) {
        super(); 
        this.statusCallback = callbackStatus;
        successCallback();
        callbackStatus(null);
    }
    public close() { 
        this.statusCallback("Disconnected");
    }

    public hosts: Cassandra.HostMap = <any>{};
    public keyspace: string = <any>{};
    public metadata: Cassandra.metadata.Metadata = <any>{};
  
    public batch(queries: Array<string> | Array<{ query: string, params?: any }>, options: Cassandra.QueryOptions, callback: Cassandra.ResultCallback): void {}
    public connect(callback: Cassandra.Callback): void {}
    public eachRow(query: string, params?: any, options?: Cassandra.QueryOptions, rowCallback?: Cassandra.Callback, callback?: Cassandra.Callback): void {}
    public execute(query: string, params?: any, options?: Cassandra.QueryOptions | Cassandra.ResultCallback, callback?: Cassandra.ResultCallback): void {}
    public getReplicas(keyspace: string, token: Buffer): Array<any> {return []} // TODO: Should this be a more explicit return?
    public shutdown(callback?: Cassandra.Callback): void {}
    public stream(query: string, params?: any, options?: Cassandra.QueryOptions, callback?: Cassandra.Callback): NodeJS.ReadableStream {return <any>{}}
}