import { DefineComponent } from 'vue';

/**
 * TSDatePicker component props
 */
export interface TSDatePickerProps {
  /**
   * TSDatePicker modelValue is day index from 0
   */
  modelValue?: number[];
  /**
   * TSDatePicker initialValue is day index from 0
   */
  initialValue?: number[];
  /**
   * Display label on top of Date Input.
   */
  label?: string;
  /**
   * Enable Validator using vee-validate. Combine with TSForm that handle form validation.
   */
  useValidator?: boolean;
  /**
   * When used as field in From Validation using TSForm,
   * specify the unique field name, match with your needs for API request.
   */
  fieldName?: string;
  /**
   * Whether this field should be filled or not.
   */
  mandatory?: boolean;
  /**
   * Sets the invalid state.
   */
  invalid?: boolean;
  /**
   * Set the custom validator message.
   * By default each field has preserved with its validator message, you don't need to worrying about the message.
   */
  errorMessage?: { empty: string };
  /**
   * Whether multiple date or date range model value.
   *
   * @default 'range'
   */
  selectionMode?: 'range' | 'multiple';
  /**
   * Validate value while the overlay is shown. This function is run on clicking the dates in the overlay.
   *
   * @returns {boolean} - Return true if the value is valid.
   */
  overlayValidatorFunction?: (value?: number[]) => Promise<boolean> | boolean;
  /**
   * Set the custom validator message to show on the overlay.
   * Used alongside overlayValidatorFunction.
   */
  overlayValidatorMessage?: string;
  /**
   * Set a message to be shown on top of the overlay.
   */
  overlayMessage?: string;
}

/**
 * TSDatePicker component emits
 */
export type TSDatePickerEmits = {
  'update:modelValue': [days?: number[]];
  // Emits when overlay is hidden
  'hide': [];
};

/**
 * **TSVue - TSDatePicker**
 *
 * _Handle input day with form validation._
 *
 * --- ---
 * ![TSVue](https://ik.imagekit.io/kurniadev/TS-HEAD-BLACK.png)
 *
 * @group form
 */
declare const TSDatePicker: DefineComponent<
  TSDatePickerProps,
  TSDatePickerEmits
>;

export default TSDatePicker;
