import { BaseEntity } from 'src/core/modules/domain/entities//base.entity';

export enum OTP_ACTION_TYPE {
  CREATE_DISCOUNT = 'CREATE_DISCOUNT',
  CANCEL_TRANSACTION = 'CANCEL_TRANSACTION',
  REJECT_RECONCILIATION = 'REJECT_RECONCILIATION',

  ACTIVATE_USER = 'ACTIVATE_USER',

  ACTIVATE_ITEM = 'ACTIVATE_ITEM',
  UPDATE_ITEM_PRICE = 'UPDATE_ITEM_PRICE',
  UPDATE_ITEM_DETAILS = 'UPDATE_ITEM_DETAILS',

  CONFIRM_TRANSACTION = 'CONFIRM_TRANSACTION',
}

export enum OTP_SOURCE {
  POS = 'POS',
  WEB = 'WEB',
}

export interface OtpVerificationEntity extends BaseEntity {
  otp_code: string;
  action_type: OTP_ACTION_TYPE;
  target_id: string;
  reference: string;
  source: OTP_SOURCE;
  is_used: boolean;
  is_replaced: boolean;
  expired_at: number;
  verified_at: number;
}

export interface OtpRequestEntity {
  action_type: OTP_ACTION_TYPE;
  source: OTP_SOURCE;
  target_id: string;
  reference: string;
}

export interface OtpVerifyEntity extends OtpRequestEntity {
  otp_code: string;
}

export interface OtpVerifierEntity {
  name: string;
  phone_number: string;
  is_all_action?: boolean;
  action_types?: OTP_ACTION_TYPE[] | null;
}
