import type {
    ComponentRef
} from "react";
import {
    type TextInputProps,
    type StyleProp,
    type ViewStyle,
    type TextStyle,
    TextInput
} from "react-native";
import {
    type NCoreUIKitIcon
} from "../../types";

export type INumericInputRef = {
    updateValue: (text: string) => void;
    cleanText: () => void;
    focus: () => void;
    blur: () => void;
};

export type NumericInputDynamicStyleType = {
    inlineSpaces: NCoreUIKit.ActivePalette["inlineSpaces"];
    typography: NCoreUIKit.ActivePalette["typography"];
    radiuses: NCoreUIKit.ActivePalette["radiuses"];
    spreadBehaviour?: NumericInputSpreadBehaviour;
    spaces: NCoreUIKit.ActivePalette["spaces"];
    colors: NCoreUIKit.ActivePalette["colors"];
    currentType: NumericInputTypes;
    borders: NCoreUIKit.Borders;
    type: NumericInputType;
    isDisabled?: boolean;
    isFocused: boolean;
    title?: string;
    icon?: boolean;
};

export type NumericInputTypes = {
    containerColor: keyof NCoreUIKit.ContainerContentColors;
    focusBorderColor: keyof NCoreUIKit.BorderContentColors;
    hintTextIconColor: keyof NCoreUIKit.IconContentColors;
    placeholderColor: keyof NCoreUIKit.TextContentColors;
    hintTextColor: keyof NCoreUIKit.TextContentColors;
    borderColor: keyof NCoreUIKit.BorderContentColors;
    inputColor: keyof NCoreUIKit.TextContentColors;
    titleColor: keyof NCoreUIKit.TextContentColors;
    iconColor: keyof NCoreUIKit.IconContentColors;
};

export type NumericInputType = "default" | "danger" | "warning" | "question" | "success" | "info";

export type NumericInputInstance = NonNullable<ComponentRef<typeof TextInput>>;

export type NumericInputSpreadBehaviour = "baseline" | "stretch" | "free";

export type NumericInputVariant = "text" | "hidden";

interface INumericInputProps extends TextInputProps {
    inputStyle?: StyleProp<TextStyle> | Array<StyleProp<TextStyle>>;
    customTheme?: {
        gapPropagation?: keyof NCoreUIKit.GapPropagationKey;
        sharpness?: keyof NCoreUIKit.SharpnessKey;
        paletteKey?: keyof NCoreUIKit.PaletteKey;
        themeKey?: keyof NCoreUIKit.ThemeKey;
    };
    customLocalize?: {
        activeLocale?: keyof NCoreUIKit.LocaleKey;
    };
    spreadBehaviour?: NumericInputSpreadBehaviour;
    onChangeText?: (value: string) => void;
    validation?: (
        text: string,
        setText: (text: string) => void
    ) => boolean;
    isAutoKeyboardDismissOnBlur?: boolean;
    hintTextContainerStyle?: ViewStyle;
    contentContainerStyle?: ViewStyle;
    isShowHideTextButton?: boolean;
    isWorkWithDebouncer?: boolean;
    hideTextIconStyle?: ViewStyle;
    rightIconOnPress?: () => void;
    hintTextIcon?: NCoreUIKitIcon;
    variant?: NumericInputVariant;
    isShowHintTextIcon?: boolean;
    cleanIconStyle?: ViewStyle;
    rightIconStyle?: ViewStyle;
    rightIcon?: NCoreUIKitIcon;
    isShowSubTitle?: boolean;
    isCleanEnabled?: boolean;
    iconOnPress?: () => void;
    type?: NumericInputType;
    initialValue?: string;
    iconStyle?: ViewStyle;
    icon?: NCoreUIKitIcon;
    placeholder?: string;
    isRequired?: boolean;
    isDisabled?: boolean;
    isOptional?: boolean;
    onFocus?: () => void;
    onBlur?: () => void;
    hintText?: string;
    subTitle?: string;
    style?: ViewStyle;
    title?: string;
    id?: string;
};
export type {
    INumericInputProps as default
};
