// 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.DateAddError.html)
 */
export class CalendarDateAddError {
    #value = undefined;

    static #values = new Map([
        ["Unknown", 0],
        ["InvalidDay", 1],
        ["MonthNotInYear", 2],
        ["Overflow", 3]
    ]);

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

        if (value instanceof CalendarDateAddError) {
            return value;
        }

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

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

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

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

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

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

    static Unknown = CalendarDateAddError.#objectValues[0];
    static InvalidDay = CalendarDateAddError.#objectValues[1];
    static MonthNotInYear = CalendarDateAddError.#objectValues[2];
    static Overflow = CalendarDateAddError.#objectValues[3];


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