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



/**
 * The sign of a Decimal, as shown in formatting.
 *
 * See the [Rust documentation for `Sign`](https://docs.rs/fixed_decimal/0.7.2/fixed_decimal/enum.Sign.html) for more information.
 */
export class DecimalSign {
    #value = undefined;

    static #values = new Map([
        ["None", 0],
        ["Negative", 1],
        ["Positive", 2]
    ]);

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

        if (value instanceof DecimalSign) {
            return value;
        }

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

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

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

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

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

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

    /**
     * No sign (implicitly positive, e.g., 1729).
     */
    static None = DecimalSign.#objectValues[0];
    /**
     * A negative sign, e.g., -1729.
     */
    static Negative = DecimalSign.#objectValues[1];
    /**
     * An explicit positive sign, e.g., +1729.
     */
    static Positive = DecimalSign.#objectValues[2];


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