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



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

    static #values = new Map([
        ["Monday", 1],
        ["Tuesday", 2],
        ["Wednesday", 3],
        ["Thursday", 4],
        ["Friday", 5],
        ["Saturday", 6],
        ["Sunday", 7]
    ]);

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

        if (value instanceof Weekday) {
            return value;
        }

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

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

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

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

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

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

    static Monday = Weekday.#objectValues[1];
    static Tuesday = Weekday.#objectValues[2];
    static Wednesday = Weekday.#objectValues[3];
    static Thursday = Weekday.#objectValues[4];
    static Friday = Weekday.#objectValues[5];
    static Saturday = Weekday.#objectValues[6];
    static Sunday = Weekday.#objectValues[7];


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