import { ButtonScanProps } from '../ButtonScan/ButtonScan.vue.d';
import { TSVueIcons } from '../Icon/Icon.vue.d';
import { ClassComponent } from '../ts-helpers';

export type ScanPayload = {
  type: 'RFID' | 'QR';
  code: string;
  device: string; // Serial Number
};

export type ButtonSearchByScanEmits = {
  scan: [payload: ScanPayload];
};

export interface ButtonSearchByScanProps {
  /**
   * The button label.
   *
   * @default 'Search by Scan'
   */
  label?: string;
  /**
   * The button icon.
   */
  icon?: TSVueIcons;
  /**
   * The datatable tablename which handles the search by scan.
   *
   * @default 'datatable' - default DataTable tablename
   */
  tableName?: string;
  /**
   * Enable bulk scan mode
   *
   * @default single
   */
  bulk?: boolean;
  scanValidation?: ButtonScanProps['scanValidation'];
}

export type ButtonSearchByScanExposes = {
  stopScan: (afterScan?: boolean) => void;
};

/**
 * **TSVue v2 - ButtonSearchByScan**
 *
 * --- ---
 * ![TSVue](https://ik.imagekit.io/kurniadev/TS-HEAD-BLACK.png)
 *
 * @group Component
 */
declare class ButtonSearchByScan extends ClassComponent<
  Record<string, unknown>,
  Record<string, unknown>,
  ButtonSearchByScanEmits,
  ButtonSearchByScanProps
> {
  stopScan: (afterScan?: boolean) => void;
}

export default ButtonSearchByScan;
