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



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

    static #values = new Map([
        ["Primary", 0],
        ["Secondary", 1],
        ["Tertiary", 2],
        ["Quaternary", 3],
        ["Identical", 4]
    ]);

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

        if (value instanceof CollatorStrength) {
            return value;
        }

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

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

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

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

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

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

    static Primary = CollatorStrength.#objectValues[0];
    static Secondary = CollatorStrength.#objectValues[1];
    static Tertiary = CollatorStrength.#objectValues[2];
    static Quaternary = CollatorStrength.#objectValues[3];
    static Identical = CollatorStrength.#objectValues[4];


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