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

    static #values = new Map([
        ["Unknown", 0],
        ["InvalidDay", 1],
        ["InvalidOrdinalMonth", 9],
        ["InvalidEra", 2],
        ["MonthCodeInvalidSyntax", 3],
        ["MonthNotInCalendar", 4],
        ["MonthNotInYear", 5],
        ["InconsistentYear", 6],
        ["InconsistentMonth", 7],
        ["NotEnoughFields", 8],
        ["TooManyFields", 10],
        ["Overflow", 11]
    ]);

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

        if (value instanceof CalendarDateFromFieldsError) {
            return value;
        }

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

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

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

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

    get value(){
        for (let entry of CalendarDateFromFieldsError.#values) {
            if (entry[1] == this.#value) {
                return entry[0];
            }
        }
    }

    /** @internal */
    get ffiValue(){
        return this.#value;
    }
    static #objectValues = {
        [0]: new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
        [1]: new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
        [9]: new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 9),
        [2]: new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
        [3]: new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
        [4]: new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4),
        [5]: new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 5),
        [6]: new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 6),
        [7]: new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 7),
        [8]: new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 8),
        [10]: new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 10),
        [11]: new CalendarDateFromFieldsError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 11),
    };

    static Unknown = CalendarDateFromFieldsError.#objectValues[0];
    static InvalidDay = CalendarDateFromFieldsError.#objectValues[1];
    static InvalidOrdinalMonth = CalendarDateFromFieldsError.#objectValues[9];
    static InvalidEra = CalendarDateFromFieldsError.#objectValues[2];
    static MonthCodeInvalidSyntax = CalendarDateFromFieldsError.#objectValues[3];
    static MonthNotInCalendar = CalendarDateFromFieldsError.#objectValues[4];
    static MonthNotInYear = CalendarDateFromFieldsError.#objectValues[5];
    static InconsistentYear = CalendarDateFromFieldsError.#objectValues[6];
    static InconsistentMonth = CalendarDateFromFieldsError.#objectValues[7];
    static NotEnoughFields = CalendarDateFromFieldsError.#objectValues[8];
    static TooManyFields = CalendarDateFromFieldsError.#objectValues[10];
    static Overflow = CalendarDateFromFieldsError.#objectValues[11];


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