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



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

    static #values = new Map([
        ["Auto", 0],
        ["Never", 1],
        ["Always", 2],
        ["Min2", 3]
    ]);

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

        if (value instanceof DecimalGroupingStrategy) {
            return value;
        }

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

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

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

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

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

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

    static Auto = DecimalGroupingStrategy.#objectValues[0];
    static Never = DecimalGroupingStrategy.#objectValues[1];
    static Always = DecimalGroupingStrategy.#objectValues[2];
    static Min2 = DecimalGroupingStrategy.#objectValues[3];


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