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



/**
 * Additional information: [1](https://docs.rs/icu/2.2.0/icu/calendar/error/enum.DateDurationParseError.html)
 */
export class DateDurationParseError {
    #value = undefined;

    static #values = new Map([
        ["InvalidStructure", 0],
        ["TimeNotSupported", 1],
        ["MissingValue", 2],
        ["DuplicateUnit", 3],
        ["NumberOverflow", 4],
        ["PlusNotAllowed", 5]
    ]);

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

        if (value instanceof DateDurationParseError) {
            return value;
        }

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

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

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

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

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

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

    static InvalidStructure = DateDurationParseError.#objectValues[0];
    static TimeNotSupported = DateDurationParseError.#objectValues[1];
    static MissingValue = DateDurationParseError.#objectValues[2];
    static DuplicateUnit = DateDurationParseError.#objectValues[3];
    static NumberOverflow = DateDurationParseError.#objectValues[4];
    static PlusNotAllowed = DateDurationParseError.#objectValues[5];


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