"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Redis = require("ioredis");
const Bluebird = require("bluebird");
const events_1 = require("events");
class RedisMock extends events_1.EventEmitter {
    constructor() {
        super();
        this.status = "connecting";
        this.internMemory = {};
        this.status = "ready";
    }
    connect(callback) { return new Bluebird(function () { }); }
    ;
    disconnect() { }
    ;
    duplicate() { return new Redis(); }
    ;
    //Extend from Commander
    getBuiltinCommands() { return []; }
    createBuiltinCommand(commandName) { return {}; }
    defineCommand(name, definition) { }
    ;
    sendCommand() { }
    ;
    //--------------------
    send_command(command, ...args) { }
    ;
    bitcount(key, start, end, callback) { return new Bluebird(function () { }); }
    ;
    get(key, callback) {
        if (this.status != "ready") {
            if (callback != undefined)
                callback(new Error("Dissconnected"), null);
        }
        else {
            let value = this.internMemory[key];
            if (value != null) {
                if (callback != undefined)
                    callback(null, value); //Library send null in this case
            }
            else {
                if (callback != undefined)
                    callback(new Error("Undefined value"), null);
            }
        }
        return new Bluebird(function () { });
    }
    ;
    getBuffer(key, callback) { return new Bluebird(function () { }); }
    ;
    set(key, value, ...args) {
        //get last
        if (args != undefined && args.length > 0) {
            let callback = args[args.length - 1];
            if (callback instanceof Function) {
                if (this.status != "ready") {
                    callback(new Error("Dissconnected"), null);
                    return;
                }
                ;
                this.internMemory[key] = value;
                callback(null, null);
            }
        }
    }
    ;
    setnx(key, value, callback) { return new Bluebird(function () { }); }
    ;
    setex(key, seconds, value, callback) { return new Bluebird(function () { }); }
    ;
    psetex(key, milliseconds, value, callback) { return new Bluebird(function () { }); }
    ;
    append(key, value, callback) { return new Bluebird(function () { }); }
    ;
    strlen(key, callback) { return new Bluebird(function () { }); }
    ;
    del(key, ...keys) {
        this.internMemory = {};
    }
    ;
    exists(...keys) { }
    ;
    setbit(key, offset, value, callback) { return new Bluebird(function () { }); }
    ;
    getbit(key, offset, callback) { return new Bluebird(function () { }); }
    ;
    setrange(key, offset, value, callback) { return new Bluebird(function () { }); }
    ;
    getrange(key, start, end, callback) { return new Bluebird(function () { }); }
    ;
    substr(key, start, end, callback) { return new Bluebird(function () { }); }
    ;
    incr(key, callback) { return new Bluebird(function () { }); }
    ;
    decr(key, callback) { return new Bluebird(function () { }); }
    ;
    mget(...keys) { }
    ;
    rpush(key, ...values) { }
    ;
    lpush(key, ...values) { }
    ;
    rpushx(key, value, callback) { return new Bluebird(function () { }); }
    ;
    lpushx(key, value, callback) { return new Bluebird(function () { }); }
    ;
    linsert(key, direction, pivot, value, callback) { return new Bluebird(function () { }); }
    ;
    rpop(key, callback) { return new Bluebird(function () { }); }
    ;
    lpop(key, callback) { return new Bluebird(function () { }); }
    ;
    brpop(...keys) { }
    ;
    blpop(...keys) { }
    ;
    brpoplpush(source, destination, timeout, callback) { return new Bluebird(function () { }); }
    ;
    llen(key, callback) { return new Bluebird(function () { }); }
    ;
    lindex(key, index, callback) { return new Bluebird(function () { }); }
    ;
    lset(key, index, value, callback) { return new Bluebird(function () { }); }
    ;
    lrange(key, start, stop, callback) { return new Bluebird(function () { }); }
    ;
    ltrim(key, start, stop, callback) { return new Bluebird(function () { }); }
    ;
    lrem(key, count, value, callback) { return new Bluebird(function () { }); }
    ;
    rpoplpush(source, destination, callback) { return new Bluebird(function () { }); }
    ;
    sadd(key, ...members) {
        let callback = members[1];
        if (callback instanceof Function) {
            if (this.status != "ready") {
                callback(false, null);
                return;
            }
            ;
            callback(null, null);
        }
    }
    srem(key, ...members) { }
    ;
    smove(source, destination, member, callback) { return new Bluebird(function () { }); }
    ;
    sismember(key, member, callback) { return new Bluebird(function () { }); }
    ;
    scard(key, callback) { return new Bluebird(function () { }); }
    ;
    spop(key, count, callback) {
        if (count instanceof Function) {
            count(null, "1234");
        }
        return new Bluebird(function () { });
    }
    ;
    spop_keyset(free_set, used_key, timestamp) {
        return new Bluebird(function (resolve, reject) { resolve("1234"); });
    }
    srandmember(key, count, callback) { return new Bluebird(function () { }); }
    ;
    sinter(...keys) { }
    ;
    sinterstore(destination, ...keys) { }
    ;
    sunion(...keys) { }
    ;
    sunionstore(destination, ...keys) { }
    ;
    sdiff(...keys) { }
    ;
    sdiffstore(destination, ...keys) { }
    ;
    smembers(key, callback) { return new Bluebird(function () { }); }
    ;
    zadd(key, ...args) { }
    ;
    zincrby(key, increment, member, callback) { return new Bluebird(function () { }); }
    ;
    zrem(key, ...members) { }
    ;
    zremrangebyscore(key, min, max, callback) { return new Bluebird(function () { }); }
    ;
    zremrangebyrank(key, start, stop, callback) { return new Bluebird(function () { }); }
    ;
    zunionstore(destination, numkeys, key, ...args) { }
    ;
    zinterstore(destination, numkeys, key, ...args) { }
    ;
    zrange(key, start, stop, withScores, callback) { return new Bluebird(function () { }); }
    ;
    zrevrange(key, start, stop, withScores, callback) { return new Bluebird(function () { }); }
    ;
    zrangebyscore(key, min, max, ...args) { }
    ;
    zrevrangebyscore(key, max, min, ...args) { }
    ;
    zcount(key, min, max, callback) { return new Bluebird(function () { }); }
    ;
    zcard(key, callback) { return new Bluebird(function () { }); }
    ;
    zscore(key, member, callback) { return new Bluebird(function () { }); }
    ;
    zrank(key, member, callback) { return new Bluebird(function () { }); }
    ;
    zrevrank(key, member, callback) { return new Bluebird(function () { }); }
    ;
    hset(key, field, value, callback) { return new Bluebird(function () { }); }
    ;
    hsetnx(key, field, value, callback) { return new Bluebird(function () { }); }
    ;
    hget(key, field, callback) { return new Bluebird(function () { }); }
    ;
    hmset(key, field, value, ...args) { return new Bluebird(function () { }); }
    ;
    hmget(key, ...fields) { }
    ;
    hincrby(key, field, increment, callback) { return new Bluebird(function () { }); }
    ;
    hincrbyfloat(key, field, increment, callback) { return new Bluebird(function () { }); }
    ;
    hdel(key, field, ...fields) { }
    ;
    hlen(key, callback) { return new Bluebird(function () { }); }
    ;
    hkeys(key, callback) { return new Bluebird(function () { }); }
    ;
    hvals(key, callback) { return new Bluebird(function () { }); }
    ;
    hgetall(key, callback) { return new Bluebird(function () { }); }
    ;
    hexists(key, field, callback) { return new Bluebird(function () { }); }
    ;
    incrby(key, increment, callback) { return new Bluebird(function () { }); }
    ;
    incrbyfloat(key, increment, callback) { return new Bluebird(function () { }); }
    ;
    decrby(key, decrement, callback) { return new Bluebird(function () { }); }
    ;
    getset(key, value, callback) { return new Bluebird(function () { }); }
    ;
    mset(key, value, ...args) { }
    ;
    msetnx(key, value, ...args) { }
    ;
    randomkey(callback) { return new Bluebird(function () { }); }
    ;
    select(index, callback) { return new Bluebird(function () { }); }
    ;
    move(key, db, callback) { return new Bluebird(function () { }); }
    ;
    rename(key, newkey, callback) { return new Bluebird(function () { }); }
    ;
    renamenx(key, newkey, callback) { return new Bluebird(function () { }); }
    ;
    expire(key, seconds, callback) { return new Bluebird(function () { }); }
    ;
    pexpire(key, milliseconds, callback) { return new Bluebird(function () { }); }
    ;
    expireat(key, timestamp, callback) { return new Bluebird(function () { }); }
    ;
    pexpireat(key, millisecondsTimestamp, callback) { return new Bluebird(function () { }); }
    ;
    keys(pattern, callback) { return new Bluebird(function () { }); }
    ;
    dbsize(callback) { return new Bluebird(function () { }); }
    ;
    auth(password, callback) { return new Bluebird(function () { }); }
    ;
    ping(message, callback) { return new Bluebird(function () { }); }
    ;
    echo(message, callback) { return new Bluebird(function () { }); }
    ;
    save(callback) { return new Bluebird(function () { }); }
    ;
    bgsave(callback) { return new Bluebird(function () { }); }
    ;
    bgrewriteaof(callback) { return new Bluebird(function () { }); }
    ;
    shutdown(save, callback) { return new Bluebird(function () { }); }
    ;
    lastsave(callback) { return new Bluebird(function () { }); }
    ;
    type(key, callback) { return new Bluebird(function () { }); }
    ;
    multi(commands, options) {
        return this;
    }
    ;
    exec(callback) { return new Bluebird(function () { }); }
    ;
    discard(callback) { return new Bluebird(function () { }); }
    ;
    sync(callback) { return new Bluebird(function () { }); }
    ;
    flushdb(callback) { return new Bluebird(function () { }); }
    ;
    flushall(callback) { return new Bluebird(function () { }); }
    ;
    sort(key, ...args) { }
    ;
    info(section, callback) { return new Bluebird(function () { }); }
    ;
    time(callback) { return new Bluebird(function () { }); }
    ;
    monitor(callback) { return new Bluebird(function () { }); }
    ;
    ttl(key, callback) { return new Bluebird(function () { }); }
    ;
    persist(key, callback) { return new Bluebird(function () { }); }
    ;
    slaveof(host, port, callback) { return new Bluebird(function () { }); }
    ;
    debug(...args) { }
    ;
    config(...args) { }
    ;
    subscribe(...channels) { }
    ;
    unsubscribe(...channels) { }
    ;
    psubscribe(...patterns) { }
    ;
    punsubscribe(...patterns) { }
    ;
    publish(channel, message, callback) { return new Bluebird(function () { }); }
    ;
    watch(...keys) { }
    ;
    unwatch(callback) { return new Bluebird(function () { }); }
    ;
    cluster(...args) { }
    ;
    restore(...args) { }
    ;
    migrate(...args) { }
    ;
    dump(key, callback) { return new Bluebird(function () { }); }
    ;
    object(subcommand, ...args) { }
    ;
    client(...args) { }
    ;
    eval(...args) { }
    ;
    evalsha(...args) { }
    ;
    script(...args) { }
    ;
    quit(callback) {
        this.status = "end";
        return new Bluebird(function () { });
    }
    ;
    scan(cursor, ...args) { }
    ;
    hscan(key, cursor, ...args) { }
    ;
    zscan(key, cursor, ...args) { }
    ;
    pfmerge(destkey, ...sourcekeys) { }
    ;
    pfadd(key, ...elements) { }
    ;
    pfcount(...keys) { }
    ;
    pipeline(commands) { return {}; }
    ;
    scanStream(options) { return new events_1.EventEmitter(); }
    ;
    hscanStream(key, options) { return new events_1.EventEmitter(); }
    ;
    zscanStream(key, options) { return new events_1.EventEmitter(); }
    ;
}
exports.default = RedisMock;
//# sourceMappingURL=redisMock.js.map