// generated by diplomat-tool
import wasm from "./diplomat-wasm.mjs";
import * as diplomatRuntime from "./diplomat-runtime.mjs";



/**
 * See the [Rust documentation for `Direction`](https://docs.rs/icu/2.2.0/icu/locale/enum.Direction.html) for more information.
 */
export class LocaleDirection {
    #value = undefined;

    static #values = new Map([
        ["LeftToRight", 0],
        ["RightToLeft", 1],
        ["Unknown", 2]
    ]);

    static getAllEntries() {
        return LocaleDirection.#values.entries();
    }

    #internalConstructor(value) {
        if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
            // We pass in two internalConstructor arguments to create *new*
            // instances of this type, otherwise the enums are treated as singletons.
            if (arguments[1] === diplomatRuntime.internalConstructor ) {
                this.#value = arguments[2];
                return this;
            }
            return LocaleDirection.#objectValues[arguments[1]];
        }

        if (value instanceof LocaleDirection) {
            return value;
        }

        let intVal = LocaleDirection.#values.get(value);

        // Nullish check, checks for null or undefined
        if (intVal != null) {
            return LocaleDirection.#objectValues[intVal];
        }

        throw TypeError(value + " is not a LocaleDirection and does not correspond to any of its enumerator values.");
    }

    /** @internal */
    static fromValue(value) {
        return new LocaleDirection(value);
    }

    get value(){
        return [...LocaleDirection.#values.keys()][this.#value];
    }

    /** @internal */
    get ffiValue(){
        return this.#value;
    }
    static #objectValues = [
        new LocaleDirection(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
        new LocaleDirection(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
        new LocaleDirection(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
    ];

    static LeftToRight = LocaleDirection.#objectValues[0];
    static RightToLeft = LocaleDirection.#objectValues[1];
    static Unknown = LocaleDirection.#objectValues[2];


    constructor(value) {
        return this.#internalConstructor(...arguments)
    }
}