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



/**
 * See the [Rust documentation for `CanonicalCombiningClass`](https://docs.rs/icu/2.1.1/icu/properties/props/struct.CanonicalCombiningClass.html) for more information.
 */
export class CanonicalCombiningClass {
    #value = undefined;

    static #values = new Map([
        ["NotReordered", 0],
        ["Overlay", 1],
        ["HanReading", 6],
        ["Nukta", 7],
        ["KanaVoicing", 8],
        ["Virama", 9],
        ["Ccc10", 10],
        ["Ccc11", 11],
        ["Ccc12", 12],
        ["Ccc13", 13],
        ["Ccc14", 14],
        ["Ccc15", 15],
        ["Ccc16", 16],
        ["Ccc17", 17],
        ["Ccc18", 18],
        ["Ccc19", 19],
        ["Ccc20", 20],
        ["Ccc21", 21],
        ["Ccc22", 22],
        ["Ccc23", 23],
        ["Ccc24", 24],
        ["Ccc25", 25],
        ["Ccc26", 26],
        ["Ccc27", 27],
        ["Ccc28", 28],
        ["Ccc29", 29],
        ["Ccc30", 30],
        ["Ccc31", 31],
        ["Ccc32", 32],
        ["Ccc33", 33],
        ["Ccc34", 34],
        ["Ccc35", 35],
        ["Ccc36", 36],
        ["Ccc84", 84],
        ["Ccc91", 91],
        ["Ccc103", 103],
        ["Ccc107", 107],
        ["Ccc118", 118],
        ["Ccc122", 122],
        ["Ccc129", 129],
        ["Ccc130", 130],
        ["Ccc132", 132],
        ["Ccc133", 133],
        ["AttachedBelowLeft", 200],
        ["AttachedBelow", 202],
        ["AttachedAbove", 214],
        ["AttachedAboveRight", 216],
        ["BelowLeft", 218],
        ["Below", 220],
        ["BelowRight", 222],
        ["Left", 224],
        ["Right", 226],
        ["AboveLeft", 228],
        ["Above", 230],
        ["AboveRight", 232],
        ["DoubleBelow", 233],
        ["DoubleAbove", 234],
        ["IotaSubscript", 240]
    ]);

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

        if (value instanceof CanonicalCombiningClass) {
            return value;
        }

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

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

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

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

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

    /** @internal */
    get ffiValue(){
        return this.#value;
    }
    static #objectValues = {
        [0]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
        [1]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
        [6]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 6),
        [7]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 7),
        [8]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 8),
        [9]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 9),
        [10]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 10),
        [11]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 11),
        [12]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 12),
        [13]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 13),
        [14]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 14),
        [15]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 15),
        [16]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 16),
        [17]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 17),
        [18]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 18),
        [19]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 19),
        [20]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 20),
        [21]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 21),
        [22]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 22),
        [23]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 23),
        [24]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 24),
        [25]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 25),
        [26]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 26),
        [27]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 27),
        [28]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 28),
        [29]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 29),
        [30]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 30),
        [31]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 31),
        [32]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 32),
        [33]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 33),
        [34]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 34),
        [35]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 35),
        [36]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 36),
        [84]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 84),
        [91]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 91),
        [103]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 103),
        [107]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 107),
        [118]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 118),
        [122]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 122),
        [129]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 129),
        [130]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 130),
        [132]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 132),
        [133]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 133),
        [200]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 200),
        [202]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 202),
        [214]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 214),
        [216]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 216),
        [218]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 218),
        [220]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 220),
        [222]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 222),
        [224]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 224),
        [226]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 226),
        [228]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 228),
        [230]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 230),
        [232]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 232),
        [233]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 233),
        [234]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 234),
        [240]: new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 240),
    };

    static NotReordered = CanonicalCombiningClass.#objectValues[0];
    static Overlay = CanonicalCombiningClass.#objectValues[1];
    static HanReading = CanonicalCombiningClass.#objectValues[6];
    static Nukta = CanonicalCombiningClass.#objectValues[7];
    static KanaVoicing = CanonicalCombiningClass.#objectValues[8];
    static Virama = CanonicalCombiningClass.#objectValues[9];
    static Ccc10 = CanonicalCombiningClass.#objectValues[10];
    static Ccc11 = CanonicalCombiningClass.#objectValues[11];
    static Ccc12 = CanonicalCombiningClass.#objectValues[12];
    static Ccc13 = CanonicalCombiningClass.#objectValues[13];
    static Ccc14 = CanonicalCombiningClass.#objectValues[14];
    static Ccc15 = CanonicalCombiningClass.#objectValues[15];
    static Ccc16 = CanonicalCombiningClass.#objectValues[16];
    static Ccc17 = CanonicalCombiningClass.#objectValues[17];
    static Ccc18 = CanonicalCombiningClass.#objectValues[18];
    static Ccc19 = CanonicalCombiningClass.#objectValues[19];
    static Ccc20 = CanonicalCombiningClass.#objectValues[20];
    static Ccc21 = CanonicalCombiningClass.#objectValues[21];
    static Ccc22 = CanonicalCombiningClass.#objectValues[22];
    static Ccc23 = CanonicalCombiningClass.#objectValues[23];
    static Ccc24 = CanonicalCombiningClass.#objectValues[24];
    static Ccc25 = CanonicalCombiningClass.#objectValues[25];
    static Ccc26 = CanonicalCombiningClass.#objectValues[26];
    static Ccc27 = CanonicalCombiningClass.#objectValues[27];
    static Ccc28 = CanonicalCombiningClass.#objectValues[28];
    static Ccc29 = CanonicalCombiningClass.#objectValues[29];
    static Ccc30 = CanonicalCombiningClass.#objectValues[30];
    static Ccc31 = CanonicalCombiningClass.#objectValues[31];
    static Ccc32 = CanonicalCombiningClass.#objectValues[32];
    static Ccc33 = CanonicalCombiningClass.#objectValues[33];
    static Ccc34 = CanonicalCombiningClass.#objectValues[34];
    static Ccc35 = CanonicalCombiningClass.#objectValues[35];
    static Ccc36 = CanonicalCombiningClass.#objectValues[36];
    static Ccc84 = CanonicalCombiningClass.#objectValues[84];
    static Ccc91 = CanonicalCombiningClass.#objectValues[91];
    static Ccc103 = CanonicalCombiningClass.#objectValues[103];
    static Ccc107 = CanonicalCombiningClass.#objectValues[107];
    static Ccc118 = CanonicalCombiningClass.#objectValues[118];
    static Ccc122 = CanonicalCombiningClass.#objectValues[122];
    static Ccc129 = CanonicalCombiningClass.#objectValues[129];
    static Ccc130 = CanonicalCombiningClass.#objectValues[130];
    static Ccc132 = CanonicalCombiningClass.#objectValues[132];
    static Ccc133 = CanonicalCombiningClass.#objectValues[133];
    static AttachedBelowLeft = CanonicalCombiningClass.#objectValues[200];
    static AttachedBelow = CanonicalCombiningClass.#objectValues[202];
    static AttachedAbove = CanonicalCombiningClass.#objectValues[214];
    static AttachedAboveRight = CanonicalCombiningClass.#objectValues[216];
    static BelowLeft = CanonicalCombiningClass.#objectValues[218];
    static Below = CanonicalCombiningClass.#objectValues[220];
    static BelowRight = CanonicalCombiningClass.#objectValues[222];
    static Left = CanonicalCombiningClass.#objectValues[224];
    static Right = CanonicalCombiningClass.#objectValues[226];
    static AboveLeft = CanonicalCombiningClass.#objectValues[228];
    static Above = CanonicalCombiningClass.#objectValues[230];
    static AboveRight = CanonicalCombiningClass.#objectValues[232];
    static DoubleBelow = CanonicalCombiningClass.#objectValues[233];
    static DoubleAbove = CanonicalCombiningClass.#objectValues[234];
    static IotaSubscript = CanonicalCombiningClass.#objectValues[240];


    /**
     * See the [Rust documentation for `for_char`](https://docs.rs/icu/2.1.1/icu/properties/props/trait.EnumeratedProperty.html#tymethod.for_char) for more information.
     */
    static forChar(ch) {

        const result = wasm.icu4x_CanonicalCombiningClass_for_char_mv1(ch);

        try {
            return new CanonicalCombiningClass(diplomatRuntime.internalConstructor, result);
        }

        finally {
        }
    }

    /**
     * Convert to an integer value usable with ICU4C and CodePointMapData
     *
     * See the [Rust documentation for `to_icu4c_value`](https://docs.rs/icu/2.1.1/icu/properties/props/struct.CanonicalCombiningClass.html#method.to_icu4c_value) for more information.
     */
    toIntegerValue() {

        const result = wasm.icu4x_CanonicalCombiningClass_to_integer_value_mv1(this.ffiValue);

        try {
            return result;
        }

        finally {
        }
    }

    /**
     * Convert from an integer value from ICU4C or CodePointMapData
     *
     * See the [Rust documentation for `from_icu4c_value`](https://docs.rs/icu/2.1.1/icu/properties/props/struct.CanonicalCombiningClass.html#method.from_icu4c_value) for more information.
     */
    static fromIntegerValue(other) {
        const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);


        const result = wasm.icu4x_CanonicalCombiningClass_from_integer_value_mv1(diplomatReceive.buffer, other);

        try {
            if (!diplomatReceive.resultFlag) {
                return null;
            }
            return new CanonicalCombiningClass(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
        }

        finally {
            diplomatReceive.free();
        }
    }

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