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



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

    static #values = new Map([
        ["Modified", 0],
        ["Unmodified", 1]
    ]);

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

        if (value instanceof TransformResult) {
            return value;
        }

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

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

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

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

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

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

    static Modified = TransformResult.#objectValues[0];
    static Unmodified = TransformResult.#objectValues[1];


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