import "react";

declare module "react" {
  interface HTMLAttributes<T> {
    onPointerEnterCapture?: (e: React.PointerEvent<T | null>) => void;
    onPointerLeaveCapture?: (e: React.PointerEvent<T | null>) => void;
    placeholder?: string;
    onResize?: any;
    onResizeCapture?: any;
  }
  interface RefAttributes<T> {
    onPointerEnterCapture?: (e: React.PointerEvent<T | null>) => void;
    onPointerLeaveCapture?: (e: React.PointerEvent<T | null>) => void;
    placeholder?: string;
    onResize?: any;
    onResizeCapture?: any;
  }
}

type ObjectTypeDto = { [key: string]: string | number | unknown | Array<any> };

interface DebounceFunction {
  (...args: string[] | ObjectTypeDto[] | number[]): void;
}

export type RequestMethod = "POST" | "GET" | "DELETE" | "PUT" | "PATCH";

export interface ApiResponseDto<T> {
  status: boolean;
  message: string;
  msg?: string;
  error?: any;
  data?: T;
  statusCode?: number;
}

export interface BooleanResultDto<T> {
  status: boolean;
  message: string;
  data?: Array<T> | object | string | number | undefined | T | any;
}

export interface ResultPaginate<T> {
  data: T;
  page: number;
  limit: number;
  total: number;
  sort: string;
  totalPage: number;
  nextPage: number;
}

export interface ITableComponentHeadersType {
  name: string;
  key: string;
  canSort?: boolean;
}

export interface ITableComponentItemsType {
  lineItems: {
    key: string | "actions";
    value: any;
  }[];
  isLast: boolean;
}

export interface IOrderTableComponentItemsType {
  lineHeader: any;
  lineItems: Array<
    {
      key: string | "actions";
      value: any;
    }[]
  >;
  isLast: boolean;
}

export interface ITableComponentItemActionsType {
  name: string;
  key: string;
  isActive: boolean;
  icon: any;
  callback: () => void;
}
