import {
    type ReactNode
} from "react";
import {
    type StyleProp,
    type ViewStyle
} from "react-native";
import type {
    NCoreUIKitIcon
} from "../../types";

export type TooltipDynamicStyleType = {
    radiuses: NCoreUIKit.ActivePalette["radiuses"];
    spaces: NCoreUIKit.ActivePalette["spaces"];
    colors: NCoreUIKit.ActivePalette["colors"];
    sizing?: "content" | "fixed";
    currentType: TooltipTypes;
    type: TooltipType;
    height?: number;
    width?: number;
};

export type TooltipTypes = {
    containerColor: keyof NCoreUIKit.ContainerContentColors;
    subTitleColor: keyof NCoreUIKit.TextContentColors;
    actionColor: keyof NCoreUIKit.TextContentColors;
    titleColor: keyof NCoreUIKit.TextContentColors;
    iconColor: keyof NCoreUIKit.IconContentColors;
};

export type TooltipTypeConstantType = {
    type: TooltipType;
};

export type TooltipType = "primary" | "danger" | "warning" | "neutral" | "success" | "info";

export type TooltipLocation = {
    horizontal: "left" | "center" | "right";
    vertical: "top" | "center" | "bottom";
};

export type TooltipInternalProps = {
    contentContainerStyle?: StyleProp<ViewStyle>[] | StyleProp<ViewStyle>;
    containerStyle?: StyleProp<ViewStyle>[] | StyleProp<ViewStyle>;
    caretStyle?: StyleProp<ViewStyle>[] | StyleProp<ViewStyle>;
    customTheme?: {
        gapPropagation?: keyof NCoreUIKit.GapPropagationKey;
        sharpness?: keyof NCoreUIKit.SharpnessKey;
        paletteKey?: keyof NCoreUIKit.PaletteKey;
        themeKey?: keyof NCoreUIKit.ThemeKey;
    };
    style?: StyleProp<ViewStyle>[] | StyleProp<ViewStyle>;
    content?: ReactNode | (() => ReactNode);
    isCloseOnPressActionButton?: boolean;
    action?: {
        onPress: (props: {
            closeAnimation: () => void;
        }) => void;
        icon?: NCoreUIKitIcon;
        style?: ViewStyle;
        title?: string;
    };
    triggerMode?: "hover" | "click";
    location?: TooltipLocation;
    isCloseOnPress?: boolean;
    icon?: NCoreUIKitIcon;
    onClosed?: () => void;
    children?: ReactNode;
    onClose?: () => void;
    isVisible?: boolean;
    onOpen?: () => void;
    type?: TooltipType;
    subTitle?: string;
    title?: string;
};

export type TooltipSizingProps = |
    {
        sizing?: "content";
        height?: never;
        width?: never;
    } |
    {
        sizing: "fixed";
        height: number;
        width: number;
    };

type ITooltipProps = TooltipInternalProps & TooltipSizingProps;

export type {
    ITooltipProps as default
};
