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



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

    static #values = new Map([
        ["Other", 0],
        ["Avagraha", 1],
        ["Bindu", 2],
        ["BrahmiJoiningNumber", 3],
        ["CantillationMark", 4],
        ["Consonant", 5],
        ["ConsonantDead", 6],
        ["ConsonantFinal", 7],
        ["ConsonantHeadLetter", 8],
        ["ConsonantInitialPostfixed", 9],
        ["ConsonantKiller", 10],
        ["ConsonantMedial", 11],
        ["ConsonantPlaceholder", 12],
        ["ConsonantPrecedingRepha", 13],
        ["ConsonantPrefixed", 14],
        ["ConsonantSubjoined", 15],
        ["ConsonantSucceedingRepha", 16],
        ["ConsonantWithStacker", 17],
        ["GeminationMark", 18],
        ["InvisibleStacker", 19],
        ["Joiner", 20],
        ["ModifyingLetter", 21],
        ["NonJoiner", 22],
        ["Nukta", 23],
        ["Number", 24],
        ["NumberJoiner", 25],
        ["PureKiller", 26],
        ["RegisterShifter", 27],
        ["SyllableModifier", 28],
        ["ToneLetter", 29],
        ["ToneMark", 30],
        ["Virama", 31],
        ["Visarga", 32],
        ["Vowel", 33],
        ["VowelDependent", 34],
        ["VowelIndependent", 35],
        ["ReorderingKiller", 36]
    ]);

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

        if (value instanceof IndicSyllabicCategory) {
            return value;
        }

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

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

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

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

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

    /** @internal */
    get ffiValue(){
        return this.#value;
    }
    static #objectValues = [
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 5),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 6),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 7),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 8),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 9),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 10),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 11),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 12),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 13),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 14),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 15),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 16),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 17),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 18),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 19),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 20),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 21),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 22),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 23),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 24),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 25),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 26),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 27),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 28),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 29),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 30),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 31),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 32),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 33),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 34),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 35),
        new IndicSyllabicCategory(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 36),
    ];

    /**
     * See the [Rust documentation for `Other`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.Other) for more information.
     */
    static Other = IndicSyllabicCategory.#objectValues[0];
    /**
     * See the [Rust documentation for `Avagraha`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.Avagraha) for more information.
     */
    static Avagraha = IndicSyllabicCategory.#objectValues[1];
    /**
     * See the [Rust documentation for `Bindu`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.Bindu) for more information.
     */
    static Bindu = IndicSyllabicCategory.#objectValues[2];
    /**
     * See the [Rust documentation for `BrahmiJoiningNumber`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.BrahmiJoiningNumber) for more information.
     */
    static BrahmiJoiningNumber = IndicSyllabicCategory.#objectValues[3];
    /**
     * See the [Rust documentation for `CantillationMark`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.CantillationMark) for more information.
     */
    static CantillationMark = IndicSyllabicCategory.#objectValues[4];
    /**
     * See the [Rust documentation for `Consonant`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.Consonant) for more information.
     */
    static Consonant = IndicSyllabicCategory.#objectValues[5];
    /**
     * See the [Rust documentation for `ConsonantDead`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ConsonantDead) for more information.
     */
    static ConsonantDead = IndicSyllabicCategory.#objectValues[6];
    /**
     * See the [Rust documentation for `ConsonantFinal`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ConsonantFinal) for more information.
     */
    static ConsonantFinal = IndicSyllabicCategory.#objectValues[7];
    /**
     * See the [Rust documentation for `ConsonantHeadLetter`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ConsonantHeadLetter) for more information.
     */
    static ConsonantHeadLetter = IndicSyllabicCategory.#objectValues[8];
    /**
     * See the [Rust documentation for `ConsonantInitialPostfixed`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ConsonantInitialPostfixed) for more information.
     */
    static ConsonantInitialPostfixed = IndicSyllabicCategory.#objectValues[9];
    /**
     * See the [Rust documentation for `ConsonantKiller`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ConsonantKiller) for more information.
     */
    static ConsonantKiller = IndicSyllabicCategory.#objectValues[10];
    /**
     * See the [Rust documentation for `ConsonantMedial`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ConsonantMedial) for more information.
     */
    static ConsonantMedial = IndicSyllabicCategory.#objectValues[11];
    /**
     * See the [Rust documentation for `ConsonantPlaceholder`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ConsonantPlaceholder) for more information.
     */
    static ConsonantPlaceholder = IndicSyllabicCategory.#objectValues[12];
    /**
     * See the [Rust documentation for `ConsonantPrecedingRepha`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ConsonantPrecedingRepha) for more information.
     */
    static ConsonantPrecedingRepha = IndicSyllabicCategory.#objectValues[13];
    /**
     * See the [Rust documentation for `ConsonantPrefixed`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ConsonantPrefixed) for more information.
     */
    static ConsonantPrefixed = IndicSyllabicCategory.#objectValues[14];
    /**
     * See the [Rust documentation for `ConsonantSubjoined`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ConsonantSubjoined) for more information.
     */
    static ConsonantSubjoined = IndicSyllabicCategory.#objectValues[15];
    /**
     * See the [Rust documentation for `ConsonantSucceedingRepha`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ConsonantSucceedingRepha) for more information.
     */
    static ConsonantSucceedingRepha = IndicSyllabicCategory.#objectValues[16];
    /**
     * See the [Rust documentation for `ConsonantWithStacker`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ConsonantWithStacker) for more information.
     */
    static ConsonantWithStacker = IndicSyllabicCategory.#objectValues[17];
    /**
     * See the [Rust documentation for `GeminationMark`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.GeminationMark) for more information.
     */
    static GeminationMark = IndicSyllabicCategory.#objectValues[18];
    /**
     * See the [Rust documentation for `InvisibleStacker`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.InvisibleStacker) for more information.
     */
    static InvisibleStacker = IndicSyllabicCategory.#objectValues[19];
    /**
     * See the [Rust documentation for `Joiner`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.Joiner) for more information.
     */
    static Joiner = IndicSyllabicCategory.#objectValues[20];
    /**
     * See the [Rust documentation for `ModifyingLetter`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ModifyingLetter) for more information.
     */
    static ModifyingLetter = IndicSyllabicCategory.#objectValues[21];
    /**
     * See the [Rust documentation for `NonJoiner`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.NonJoiner) for more information.
     */
    static NonJoiner = IndicSyllabicCategory.#objectValues[22];
    /**
     * See the [Rust documentation for `Nukta`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.Nukta) for more information.
     */
    static Nukta = IndicSyllabicCategory.#objectValues[23];
    /**
     * See the [Rust documentation for `Number`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.Number) for more information.
     */
    static Number = IndicSyllabicCategory.#objectValues[24];
    /**
     * See the [Rust documentation for `NumberJoiner`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.NumberJoiner) for more information.
     */
    static NumberJoiner = IndicSyllabicCategory.#objectValues[25];
    /**
     * See the [Rust documentation for `PureKiller`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.PureKiller) for more information.
     */
    static PureKiller = IndicSyllabicCategory.#objectValues[26];
    /**
     * See the [Rust documentation for `RegisterShifter`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.RegisterShifter) for more information.
     */
    static RegisterShifter = IndicSyllabicCategory.#objectValues[27];
    /**
     * See the [Rust documentation for `SyllableModifier`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.SyllableModifier) for more information.
     */
    static SyllableModifier = IndicSyllabicCategory.#objectValues[28];
    /**
     * See the [Rust documentation for `ToneLetter`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ToneLetter) for more information.
     */
    static ToneLetter = IndicSyllabicCategory.#objectValues[29];
    /**
     * See the [Rust documentation for `ToneMark`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ToneMark) for more information.
     */
    static ToneMark = IndicSyllabicCategory.#objectValues[30];
    /**
     * See the [Rust documentation for `Virama`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.Virama) for more information.
     */
    static Virama = IndicSyllabicCategory.#objectValues[31];
    /**
     * See the [Rust documentation for `Visarga`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.Visarga) for more information.
     */
    static Visarga = IndicSyllabicCategory.#objectValues[32];
    /**
     * See the [Rust documentation for `Vowel`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.Vowel) for more information.
     */
    static Vowel = IndicSyllabicCategory.#objectValues[33];
    /**
     * See the [Rust documentation for `VowelDependent`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.VowelDependent) for more information.
     */
    static VowelDependent = IndicSyllabicCategory.#objectValues[34];
    /**
     * See the [Rust documentation for `VowelIndependent`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.VowelIndependent) for more information.
     */
    static VowelIndependent = IndicSyllabicCategory.#objectValues[35];
    /**
     * See the [Rust documentation for `ReorderingKiller`](https://docs.rs/icu/2.2.0/icu/properties/props/struct.IndicSyllabicCategory.html#associatedconstant.ReorderingKiller) for more information.
     */
    static ReorderingKiller = IndicSyllabicCategory.#objectValues[36];


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

        const result = wasm.icu4x_IndicSyllabicCategory_for_char_mv1(ch);

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

        finally {
            diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
        }
    }

    /**
     * Get the "long" name of this property value (returns empty if property value is unknown)
     *
     * See the [Rust documentation for `get`](https://docs.rs/icu/2.2.0/icu/properties/struct.PropertyNamesLongBorrowed.html#method.get) for more information.
     */
    longName() {
        const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 9, 4, true);


        const result = wasm.icu4x_IndicSyllabicCategory_long_name_mv1(diplomatReceive.buffer, this.ffiValue);

        try {
            if (!diplomatReceive.resultFlag) {
                return null;
            }
            return new diplomatRuntime.DiplomatSliceStr(wasm, diplomatReceive.buffer,  "string8", []).getValue();
        }

        finally {
            diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
            diplomatReceive.free();
        }
    }

    /**
     * Get the "short" name of this property value (returns empty if property value is unknown)
     *
     * See the [Rust documentation for `get`](https://docs.rs/icu/2.2.0/icu/properties/struct.PropertyNamesShortBorrowed.html#method.get) for more information.
     */
    shortName() {
        const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 9, 4, true);


        const result = wasm.icu4x_IndicSyllabicCategory_short_name_mv1(diplomatReceive.buffer, this.ffiValue);

        try {
            if (!diplomatReceive.resultFlag) {
                return null;
            }
            return new diplomatRuntime.DiplomatSliceStr(wasm, diplomatReceive.buffer,  "string8", []).getValue();
        }

        finally {
            diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
            diplomatReceive.free();
        }
    }

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

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

        try {
            return result;
        }

        finally {
            diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
        }
    }

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


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

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

        finally {
            diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
            diplomatReceive.free();
        }
    }

    static tryFromStr(s) {
        let functionCleanupArena = new diplomatRuntime.CleanupArena();

        const sSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, s)));
        const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);


        const result = wasm.icu4x_IndicSyllabicCategory_try_from_str_mv1(diplomatReceive.buffer, sSlice.ptr);

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

        finally {
            diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
            functionCleanupArena.free();

            diplomatReceive.free();
        }
    }

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