import { ReactNode } from 'react';
import { Control, FieldError } from 'react-hook-form';
import { UsePaginationType } from '@akinon/next/hooks/use-pagination';

export interface ButtonProps
  extends React.ButtonHTMLAttributes<HTMLButtonElement> {
  appearance?: 'filled' | 'outlined' | 'ghost' | 'link' | string;
  size?: 'sm' | 'md' | 'lg' | 'xl';
  href?: string;
  target?: '_blank' | '_self' | '_parent' | '_top';
}

export interface PaginationProps {
  total: number | undefined;
  limit?: number | undefined;
  currentPage: number | undefined;
  numberOfPages?: number | undefined;
  containerClassName?: string;
  moreButtonClassName?: string;
  prevClassName?: string;
  nextClassName?: string;
  pageClassName?: string;
  threshold?: number | undefined;
  delta?: number | undefined;
  render?: (pagination: UsePaginationType) => ReactNode;
  type?: 'infinite' | 'list' | 'more';
  onPageChange?: (page: number) => void;
  direction?: 'next' | 'prev';
  isLoading?: boolean;
  customStyles?: {
    marginTop?: string;
    marginBottom?: string;
    pageFontSize?: string;
    pageColor?: string;
    pageActiveColor?: string;
    pageActiveFontWeight?: string;
    pageGap?: string;
    pageBgColor?: string;
    pageActiveBgColor?: string;
    pagePaddingX?: string;
    pagePaddingY?: string;
    pageBorderRadius?: string;
    pageBorderWidth?: string;
    pageBorderColor?: string;
    pageActiveBorderColor?: string;
    arrowColor?: string;
    buttonBgColor?: string;
    buttonTextColor?: string;
    buttonBorderRadius?: string;
    buttonPaddingX?: string;
    buttonPaddingY?: string;
  };
}

export interface FileInputProps extends React.HTMLProps<HTMLInputElement> {
  fileClassName?: string;
  fileNameWrapperClassName?: string;
  fileInputClassName?: string;
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
  buttonClassName?: string;
}

export type RadioProps = React.HTMLProps<HTMLInputElement>;

export interface InputProps extends React.HTMLProps<HTMLInputElement> {
  label?: string;
  labelStyle?: 'default' | 'floating';
  error?: FieldError | undefined;
  control?: Control<any, any>;
  required?: boolean;
}

export interface CheckboxProps extends React.HTMLProps<HTMLInputElement> {
  error?: FieldError | undefined;
}

export type SelectItem = {
  label: string | number;
  value: string | number;
  class?: string;
  is_selected?: boolean;
};
export interface SelectProps extends React.HTMLProps<HTMLSelectElement> {
  options: SelectItem[];
  borderless?: boolean;
  icon?: string;
  iconSize?: number;
  error?: FieldError | undefined;
  required?: boolean;
  labelClassName?: string;
}
export interface IconProps extends React.ComponentPropsWithRef<'i'> {
  name: string;
  size?: number;
  className?: string;
}

export interface PriceProps extends React.HTMLProps<HTMLSpanElement> {
  children: ReactNode;
}

export interface ShareProps extends React.HTMLProps<HTMLElement> {
  buttonText?: string;
  buttonIconName?: string;
  buttonIconSize?: number;
  buttonClassName?: string;
  buttonAppearance?: 'filled' | 'outlined' | 'ghost';
  buttonIconProps?: React.ComponentPropsWithoutRef<'i'>;
  className?: string;
  items: ShareItem[];
}

export type ShareItem = {
  iconName: string;
  iconSize?: number;
  href: string;
  className?: string;
};

export interface BadgeProps {
  children: ReactNode;
  className?: string;
}

export type AccordionProps = {
  isCollapse?: boolean;
  collapseClassName?: string;
  title?: string;
  subTitle?: string;
  icons?: string[];
  iconSize?: number;
  iconColor?: string;
  children?: ReactNode;
  headerClassName?: string;
  className?: string;
  titleClassName?: string;
  subTitleClassName?: string;
  dataTestId?: string;
  contentClassName?: string;
  leftIcon?: string;
  leftIconSize?: number;
  leftIconClassName?: string;
};
