import { State } from '../primitives.js';
import Symbol from './symbol.js';
/**
 * All symbols which contain a number should extend this class to be compatible with off by X rules.
 */
export default class NumberSymbol extends Symbol {
    constructor(x, y, number) {
        super(x, y);
        Object.defineProperty(this, "x", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: x
        });
        Object.defineProperty(this, "y", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: y
        });
        Object.defineProperty(this, "number", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: number
        });
        this.number = number;
    }
    validateSymbol(grid) {
        const { completed, possible } = this.countTiles(grid);
        if (completed > this.number || possible < this.number)
            return State.Error;
        if (completed === this.number && possible === this.number)
            return State.Satisfied;
        return State.Incomplete;
    }
    withNumber(number) {
        return this.copyWith({ number });
    }
}
export const instance = undefined;
