import {
    type ReactNode
} from "react";
import {
    type StyleProp,
    type ViewStyle
} from "react-native";
import type {
    ModalInternalProps
} from "../modal/type";
import type IButtonProps from "../button/type";
import type {
    INCoreUIKitIconProps
} from "../../types";
import type {
    ButtonDisplayBehaviourWhileLoading
} from "../button/type";

export type IDialogRef = {
    closeAnimation: (onClosed: (props: {
        id: string;
    }) => void) => void;
};

export type DialogDynamicStyleType = {
    radiuses: NCoreUIKit.ActivePalette["radiuses"];
    colors: NCoreUIKit.ActivePalette["colors"];
    spaces: NCoreUIKit.ActivePalette["spaces"];
    contentJustify?: DialogContentJustify;
    variant: DialogVariant;
    isVisible?: boolean;
};

export type DialogVariant = "yes-no" | "ok" | "info";

export type DialogContentJustify = "centered" | "language-based";

type DialogButton = {
    displayBehaviourWhileLoading?: ButtonDisplayBehaviourWhileLoading;
    onPress?: (props: {
        closeAnimation: (onClosed?: (props: {
            id: string;
        }) => void) => void;
    }) => void;
    isLoading?: boolean;
    title?: string;
};

interface IDialogProps {
    bottomContentContainerStyle?: StyleProp<ViewStyle> | Array<StyleProp<ViewStyle>>;
    contentContainerStyle?: StyleProp<ViewStyle> | Array<StyleProp<ViewStyle>>;
    bottomContainerStyle?: StyleProp<ViewStyle> | Array<StyleProp<ViewStyle>>;
    headerContainerStyle?: StyleProp<ViewStyle> | Array<StyleProp<ViewStyle>>;
    style?: StyleProp<ViewStyle> | Array<StyleProp<ViewStyle>>;
    onOverlayPress?: (props: {
        closeAnimation: (onClosed?: (props: {
            id: string;
        }) => void) => void;
    }) => void;
    secondaryButtonStyle?: IButtonProps["style"];
    modalProps?: Omit<ModalInternalProps, "id">;
    primaryButtonStyle?: IButtonProps["style"];
    closeIconProps?: INCoreUIKitIconProps;
    contentJustify?: DialogContentJustify;
    secondaryButtonProps?: DialogButton;
    primaryButtonProps?: DialogButton;
    closeAnimationDelay?: number;
    openAnimationDelay?: number;
    headerComponent?: ReactNode;
    bottomComponent?: ReactNode;
    variant?: DialogVariant;
    children?: ReactNode;
    isVisible?: boolean;
    withModal?: boolean;
    onClosed?: (props: {
        id: string;
    }) => void;
    content?: string;
    title: string;
    id?: string;
};

export type {
    IDialogProps as default
};
