"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonGetCommand = void 0;
const command_js_1 = require("./command.js");
/**
 * @see https://redis.io/commands/json.get
 */
class JsonGetCommand extends command_js_1.Command {
    constructor(cmd, opts) {
        const command = ["JSON.GET"];
        if (typeof cmd[1] === "string") {
            // @ts-ignore - we know this is a string
            command.push(...cmd);
        }
        else {
            command.push(cmd[0]);
            if (cmd[1]) {
                if (cmd[1].indent) {
                    command.push("INDENT", cmd[1].indent);
                }
                if (cmd[1].newline) {
                    command.push("NEWLINE", cmd[1].newline);
                }
                if (cmd[1].space) {
                    command.push("SPACE", cmd[1].space);
                }
            }
            // @ts-ignore - we know this is a string
            command.push(...cmd.slice(2));
        }
        super(command, opts);
    }
}
exports.JsonGetCommand = JsonGetCommand;
