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



/**
 * See the [Rust documentation for `YearStyle`](https://docs.rs/icu/2.2.0/icu/datetime/options/enum.YearStyle.html) for more information.
 */
export class YearStyle {
    #value = undefined;

    static #values = new Map([
        ["Auto", 0],
        ["Full", 1],
        ["WithEra", 2],
        ["NoEra", 3]
    ]);

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

        if (value instanceof YearStyle) {
            return value;
        }

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

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

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

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

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

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

    static Auto = YearStyle.#objectValues[0];
    static Full = YearStyle.#objectValues[1];
    static WithEra = YearStyle.#objectValues[2];
    static NoEra = YearStyle.#objectValues[3];


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