// generated by diplomat-tool
import type { LocaleParseError } from "./LocaleParseError"
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";



/**
 * An ICU4X Locale, capable of representing strings like `"en-US"`.
 *
 * See the [Rust documentation for `Locale`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html) for more information.
 */
export class Locale {
    /** @internal */
    get ffiValue(): pointer;
    /** @internal */
    constructor();


    /**
     * Construct an {@link Locale} from an locale identifier.
     *
     * This will run the complete locale parsing algorithm. If code size and
     * performance are critical and the locale is of a known shape (such as
     * `aa-BB`) use `create_und`, `set_language`, `set_script`, and `set_region`.
     *
     * See the [Rust documentation for `try_from_str`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#method.try_from_str) for more information.
     */
    static fromString(name: string): Locale;

    /**
     * Construct a unknown {@link Locale} "und".
     *
     * See the [Rust documentation for `UNKNOWN`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#associatedconstant.UNKNOWN) for more information.
     */
    static unknown(): Locale;

    /**
     * Clones the {@link Locale}.
     *
     * See the [Rust documentation for `Locale`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html) for more information.
     */
    clone(): Locale;

    /**
     * Returns a string representation of the `LanguageIdentifier` part of
     * {@link Locale}.
     *
     * See the [Rust documentation for `id`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#structfield.id) for more information.
     */
    get basename(): string;

    /**
     * Returns a string representation of the unicode extension.
     *
     * See the [Rust documentation for `extensions`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#structfield.extensions) for more information.
     */
    getUnicodeExtension(s: string): string | null;

    /**
     * Set a Unicode extension.
     *
     * See the [Rust documentation for `extensions`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#structfield.extensions) for more information.
     */
    setUnicodeExtension(k: string, v: string): boolean;

    /**
     * Returns a string representation of {@link Locale} language.
     *
     * See the [Rust documentation for `id`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#structfield.id) for more information.
     */
    get language(): string;

    /**
     * Set the language part of the {@link Locale}.
     *
     * See the [Rust documentation for `try_from_str`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#method.try_from_str) for more information.
     */
    set language(s: string);

    /**
     * Returns a string representation of {@link Locale} region.
     *
     * See the [Rust documentation for `id`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#structfield.id) for more information.
     */
    get region(): string | null;

    /**
     * Set the region part of the {@link Locale}.
     *
     * See the [Rust documentation for `try_from_str`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#method.try_from_str) for more information.
     */
    set region(s: string);

    /**
     * Returns a string representation of {@link Locale} script.
     *
     * See the [Rust documentation for `id`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#structfield.id) for more information.
     */
    get script(): string | null;

    /**
     * Set the script part of the {@link Locale}. Pass an empty string to remove the script.
     *
     * See the [Rust documentation for `try_from_str`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#method.try_from_str) for more information.
     */
    set script(s: string);

    /**
     * Returns a string representation of the {@link Locale} variants.
     *
     * See the [Rust documentation for `Variants`](https://docs.rs/icu/2.2.0/icu/locale/struct.Variants.html) for more information.
     */
    variants(): string;

    /**
     * Returns the number of variants in this {@link Locale}.
     *
     * See the [Rust documentation for `Variants`](https://docs.rs/icu/2.2.0/icu/locale/struct.Variants.html) for more information.
     */
    get variantCount(): number;

    /**
     * Returns the variant at the given index, or nothing if the index is out of bounds.
     *
     * See the [Rust documentation for `Variants`](https://docs.rs/icu/2.2.0/icu/locale/struct.Variants.html) for more information.
     */
    variantAt(index: number): string | null;

    /**
     * Returns whether the {@link Locale} has a specific variant.
     *
     * See the [Rust documentation for `Variants`](https://docs.rs/icu/2.2.0/icu/locale/struct.Variants.html) for more information.
     */
    hasVariant(s: string): boolean;

    /**
     * Adds a variant to the {@link Locale}.
     *
     * Returns an error if the variant string is invalid.
     * Returns `true` if the variant was added, `false` if already present.
     *
     * See the [Rust documentation for `push`](https://docs.rs/icu/2.2.0/icu/locale/struct.Variants.html#method.push) for more information.
     */
    addVariant(s: string): boolean;

    /**
     * Removes a variant from the {@link Locale}.
     *
     * Returns `true` if the variant was removed, `false` if not present.
     * Returns `false` for invalid variant strings (they cannot exist in the locale).
     *
     * See the [Rust documentation for `remove`](https://docs.rs/icu/2.2.0/icu/locale/struct.Variants.html#method.remove) for more information.
     */
    removeVariant(s: string): boolean;

    /**
     * Clears all variants from the {@link Locale}.
     *
     * See the [Rust documentation for `clear`](https://docs.rs/icu/2.2.0/icu/locale/struct.Variants.html#method.clear) for more information.
     */
    clearVariants(): void;

    /**
     * Normalizes a locale string.
     *
     * See the [Rust documentation for `normalize`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#method.normalize) for more information.
     */
    static normalize(s: string): string;

    /**
     * Returns a string representation of {@link Locale}.
     *
     * See the [Rust documentation for `write_to`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#method.write_to) for more information.
     */
    toString(): string;

    /**
     * See the [Rust documentation for `normalizing_eq`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#method.normalizing_eq) for more information.
     */
    normalizingEq(other: string): boolean;

    /**
     * See the [Rust documentation for `strict_cmp`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#method.strict_cmp) for more information.
     */
    compareToString(other: string): number;

    /**
     * See the [Rust documentation for `total_cmp`](https://docs.rs/icu/2.2.0/icu/locale/struct.Locale.html#method.total_cmp) for more information.
     */
    compareTo(other: Locale): number;
}