"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZRangeCommand = void 0;
const command_js_1 = require("./command.js");
/**
 * @see https://redis.io/commands/zrange
 */
class ZRangeCommand extends command_js_1.Command {
    constructor([key, min, max, opts], cmdOpts) {
        const command = ["zrange", key, min, max];
        // Either byScore or byLex is allowed
        if (opts?.byScore) {
            command.push("byscore");
        }
        if (opts?.byLex) {
            command.push("bylex");
        }
        if (opts?.rev) {
            command.push("rev");
        }
        if (typeof opts?.count !== "undefined" && typeof opts?.offset !== "undefined") {
            command.push("limit", opts.offset, opts.count);
        }
        if (opts?.withScores) {
            command.push("withscores");
        }
        super(command, cmdOpts);
    }
}
exports.ZRangeCommand = ZRangeCommand;
