import { ConfigType } from '../config.js';
import GridData from '../grid.js';
import { Direction, Orientation } from '../primitives.js';
import DirectionLinkerSymbol from './directionLinkerSymbol.js';
class LotusSymbol extends DirectionLinkerSymbol {
    /**
     * **Areas containing this symbol must be symmetrical**
     *
     * @param x - The x-coordinate of the symbol.
     * @param y - The y-coordinate of the symbol.
     * @param orientation - The orientation of the symbol.
     */
    constructor(x, y, orientation) {
        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, "orientation", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: orientation
        });
        super.changeDirections(LotusSymbol.linkedDirectionsFromOrientation[orientation]);
    }
    get id() {
        return `lotus`;
    }
    get explanation() {
        return `Areas containing this symbol must be *symmetrical*`;
    }
    get configs() {
        return Object.freeze([
            {
                type: ConfigType.Number,
                default: 0,
                field: 'x',
                description: 'X',
                configurable: false,
            },
            {
                type: ConfigType.Number,
                default: 0,
                field: 'y',
                description: 'Y',
                configurable: false,
            },
            {
                type: ConfigType.Orientation,
                default: Orientation.Up,
                field: 'orientation',
                description: 'Orientation',
                configurable: true,
            },
        ]);
    }
    createExampleGrid() {
        return Object.freeze(GridData.create(['wwbww', 'bwbwb', 'bwwwb', 'bwwwb']).addSymbol(new LotusSymbol(2, 2, Orientation.Up)));
    }
    validateSymbol(grid) {
        return super.validateSymbol(grid);
    }
    copyWith({ x, y, orientation, }) {
        return new LotusSymbol(x ?? this.x, y ?? this.y, orientation ?? this.orientation);
    }
}
Object.defineProperty(LotusSymbol, "linkedDirectionsFromOrientation", {
    enumerable: true,
    configurable: true,
    writable: true,
    value: {
        [Orientation.Up]: {
            [Direction.Left]: Direction.Right,
            [Direction.Up]: Direction.Up,
            [Direction.Right]: Direction.Left,
            [Direction.Down]: Direction.Down,
        },
        [Orientation.UpRight]: {
            [Direction.Left]: Direction.Down,
            [Direction.Up]: Direction.Right,
            [Direction.Right]: Direction.Up,
            [Direction.Down]: Direction.Left,
        },
        [Orientation.Right]: {
            [Direction.Left]: Direction.Left,
            [Direction.Up]: Direction.Down,
            [Direction.Right]: Direction.Right,
            [Direction.Down]: Direction.Up,
        },
        [Orientation.DownRight]: {
            [Direction.Left]: Direction.Up,
            [Direction.Up]: Direction.Left,
            [Direction.Right]: Direction.Down,
            [Direction.Down]: Direction.Right,
        },
        [Orientation.Down]: {
            [Direction.Left]: Direction.Right,
            [Direction.Up]: Direction.Up,
            [Direction.Right]: Direction.Left,
            [Direction.Down]: Direction.Down,
        },
        [Orientation.DownLeft]: {
            [Direction.Left]: Direction.Down,
            [Direction.Up]: Direction.Right,
            [Direction.Right]: Direction.Up,
            [Direction.Down]: Direction.Left,
        },
        [Orientation.Left]: {
            [Direction.Left]: Direction.Left,
            [Direction.Up]: Direction.Down,
            [Direction.Right]: Direction.Right,
            [Direction.Down]: Direction.Up,
        },
        [Orientation.UpLeft]: {
            [Direction.Left]: Direction.Up,
            [Direction.Up]: Direction.Left,
            [Direction.Right]: Direction.Down,
            [Direction.Down]: Direction.Right,
        },
    }
});
export default LotusSymbol;
export const instance = new LotusSymbol(0, 0, Orientation.Up);
