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 ITextAreaInputRef = {
    updateValue: (text: string) => void;
    cleanText: () => void;
    focus: () => void;
    blur: () => void;
};

export type TextAreaInputDynamicStyleType = {
    inlineSpaces: NCoreUIKit.ActivePalette["inlineSpaces"];
    typography: NCoreUIKit.ActivePalette["typography"];
    spreadBehaviour?: TextAreaInputSpreadBehaviour;
    radiuses: NCoreUIKit.ActivePalette["radiuses"];
    spaces: NCoreUIKit.ActivePalette["spaces"];
    colors: NCoreUIKit.ActivePalette["colors"];
    currentType: TextAreaInputTypes;
    borders: NCoreUIKit.Borders;
    type: TextAreaInputType;
    isDisabled?: boolean;
    maxHeight?: number;
    isFocused: boolean;
    title?: string;
    icon?: boolean;
};

export type TextAreaInputTypes = {
    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 TextAreaInputInstance = NonNullable<ComponentRef<typeof TextInput>>;

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

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

interface ITextAreaInputProps extends TextInputProps {
    customTheme?: {
        gapPropagation?: NCoreUIKit.GapPropagationKey;
        sharpness?: NCoreUIKit.SharpnessKey;
        paletteKey?: NCoreUIKit.PaletteKey;
        themeKey?: NCoreUIKit.ThemeKey;
    };
    customLocalize?: {
        activeLocale?: NCoreUIKit.LocaleKey;
    };
    spreadBehaviour?: TextAreaInputSpreadBehaviour;
    onChangeText?: (value: string) => void;
    validation?: (text: string) => boolean;
    isAutoKeyboardDismissOnBlur?: boolean;
    hintTextContainerStyle?: ViewStyle;
    contentContainerStyle?: ViewStyle;
    inputStyle?: StyleProp<TextStyle>;
    isShowLengthLimiter?: boolean;
    rightIconOnPress?: () => void;
    hintTextIcon?: NCoreUIKitIcon;
    isShowHintTextIcon?: boolean;
    isUpdateOnRealtime?: boolean;
    cleanIconStyle?: ViewStyle;
    rightIconStyle?: ViewStyle;
    rightIcon?: NCoreUIKitIcon;
    isShowSubTitle?: boolean;
    isCleanEnabled?: boolean;
    iconOnPress?: () => void;
    type?: TextAreaInputType;
    initialValue?: string;
    iconStyle?: ViewStyle;
    icon?: NCoreUIKitIcon;
    placeholder?: string;
    isRequired?: boolean;
    isDisabled?: boolean;
    isOptional?: boolean;
    onFocus?: () => void;
    onBlur?: () => void;
    maxHeight?: number;
    hintText?: string;
    subTitle?: string;
    style?: ViewStyle;
    title?: string;
    id?: string;
};
export type {
    ITextAreaInputProps as default
};
