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



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

    static #values = new Map([
        ["Off", 0],
        ["On", 1]
    ]);

    static getAllEntries() {
        return CollatorCaseLevel.#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 CollatorCaseLevel.#objectValues[arguments[1]];
        }

        if (value instanceof CollatorCaseLevel) {
            return value;
        }

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

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

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

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

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

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

    static Off = CollatorCaseLevel.#objectValues[0];
    static On = CollatorCaseLevel.#objectValues[1];


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