"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const BaseForLines_1 = require("./BaseForLines");
var COMMAND_TYPE;
(function (COMMAND_TYPE) {
    COMMAND_TYPE["SFX"] = "SFX";
    COMMAND_TYPE["CANCEL"] = "CANCEL";
    COMMAND_TYPE["CHECKPOINT"] = "CHECKPOINT";
    COMMAND_TYPE["RESTART"] = "RESTART";
    COMMAND_TYPE["MESSAGE"] = "MESSAGE";
    COMMAND_TYPE["WIN"] = "WIN";
    COMMAND_TYPE["AGAIN"] = "AGAIN"; // This acts more as a RULE_MODIFIER but is included here for parsing and then is moved into the modifier section
})(COMMAND_TYPE = exports.COMMAND_TYPE || (exports.COMMAND_TYPE = {}));
class AbstractCommand extends BaseForLines_1.BaseForLines {
    getSound() {
        throw new Error(`BUG: Check getType() first`);
    }
    getMessage() {
        throw new Error(`BUG: Check getType() first`);
    }
}
exports.AbstractCommand = AbstractCommand;
class MessageCommand extends AbstractCommand {
    constructor(source, message) {
        super(source);
        this.message = message;
    }
    getType() { return COMMAND_TYPE.MESSAGE; }
    getMessage() { return this.message; }
    // These are used by message levels. Maybe we should split this into 2 classes
    isInvalid() {
        return null;
    }
    isMap() {
        return false;
    }
    toKey() { return `[MESSAGE:"${this.message}"]`; }
}
exports.MessageCommand = MessageCommand;
class SoundCommand extends AbstractCommand {
    constructor(source, sound) {
        super(source);
        this.sound = sound;
        if (!sound) {
            throw new Error(`ERROR: Sound not found\n${this.toString()}`);
        }
    }
    getType() { return COMMAND_TYPE.SFX; }
    getSound() {
        return this.sound;
    }
    toKey() { return `[SOUND:${this.sound.soundCode}]`; }
}
exports.SoundCommand = SoundCommand;
class CancelCommand extends AbstractCommand {
    constructor(source) {
        super(source);
    }
    getType() { return COMMAND_TYPE.CANCEL; }
    toKey() { return `[CANCEL]`; }
}
exports.CancelCommand = CancelCommand;
class CheckpointCommand extends AbstractCommand {
    constructor(source) {
        super(source);
    }
    getType() { return COMMAND_TYPE.CHECKPOINT; }
    toKey() { return `[CHECKPOINT]`; }
}
exports.CheckpointCommand = CheckpointCommand;
class RestartCommand extends AbstractCommand {
    constructor(source) {
        super(source);
    }
    getType() { return COMMAND_TYPE.RESTART; }
    toKey() { return `[RESTART]`; }
}
exports.RestartCommand = RestartCommand;
class WinCommand extends AbstractCommand {
    constructor(source) {
        super(source);
    }
    getType() { return COMMAND_TYPE.WIN; }
    toKey() { return `[WIN]`; }
}
exports.WinCommand = WinCommand;
class AgainCommand extends AbstractCommand {
    constructor(source) {
        super(source);
    }
    getType() { return COMMAND_TYPE.AGAIN; }
    toKey() { return `[AGAIN]`; }
}
exports.AgainCommand = AgainCommand;
//# sourceMappingURL=command.js.map