"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const BaseForLines_1 = require("./BaseForLines");
class LevelMap extends BaseForLines_1.BaseForLines {
    constructor(source, rows) {
        super(source);
        this.rows = rows;
    }
    isInvalid() {
        const firstRowLength = this.rows[0].length;
        let isInvalid = null;
        this.rows.forEach((row, index) => {
            if (firstRowLength !== row.length) {
                isInvalid = `Row ${index + 1} does not have the same column count as the first row. Expected ${firstRowLength} columns but found ${row.length}.`;
            }
        });
        return isInvalid;
    }
    isMap() {
        return true;
    }
    getRows() {
        return this.rows;
    }
    getWidth() {
        return this.rows[0].length;
    }
    getHeight() {
        return this.rows.length;
    }
    getMessage() {
        throw new Error(`BUG: Check .isMap() before calling this`);
    }
}
exports.LevelMap = LevelMap;
class MessageLevel extends BaseForLines_1.BaseForLines {
    constructor(source, message) {
        super(source);
        this.message = message;
    }
    isInvalid() { return null; }
    isMap() {
        return false;
    }
    getRows() {
        throw new Error(`BUG: Should have checked isMap first`);
    }
    getMessage() {
        return this.message;
    }
    getWidth() {
        throw new Error(`BUG: Should have checked isMap first`);
    }
    getHeight() {
        throw new Error(`BUG: Should have checked isMap first`);
    }
}
exports.MessageLevel = MessageLevel;
//# sourceMappingURL=level.js.map