import { IconType } from 'react-icons';

export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'success' | 'warning';
export type ButtonSize = 'sm' | 'md' | 'lg';

export interface BaseButtonProps {
  variant?: ButtonVariant;
  size?: ButtonSize;
  disabled?: boolean;
  loading?: boolean;
  className?: string;
  children?: React.ReactNode;
  onClick?: () => void;
  type?: 'button' | 'submit' | 'reset';
}

export interface ButtonWithIconProps extends BaseButtonProps {
  icon?: IconType;
  iconPosition?: 'left' | 'right';
}

export interface UploadButtonProps extends BaseButtonProps {
  onUpload: (file: File) => Promise<void>;
  accept?: string;
  multiple?: boolean;
  icon?: IconType;
  iconPosition?: 'left' | 'right';
}

export interface CreateButtonFieldConfig {
  key: string;
  label: string;
  type: 'string' | 'boolean' | 'email' | 'textarea' | 'date' | 'enum' | 'multiselect' | 'readonly';
  required?: boolean;
  placeholder?: string;
  minRows?: number;
  maxRows?: number;
  validator?: (value: any) => string | null;
  defaultValue?: any;
  // Options for enum/select/multiselect fields - can be array of strings or array of {value, label} objects
  options?: string[] | Array<{ value: string | number; label: string }>;
  // Options reference for fetching from API (e.g., "user.role")
  optionsReference?: string;
}

export interface CreateButtonProps extends BaseButtonProps {
  onCreate: (data: any) => Promise<any>;
  fields: CreateButtonFieldConfig[];
  popupTitle?: string;
  popupSize?: 'small' | 'medium' | 'large';
  icon?: IconType;
  iconPosition?: 'left' | 'right';
  onSuccess?: (result: any) => void;
  onError?: (error: string) => void;
  multiStep?: boolean; // Enable multi-step form mode
}