import { Document, Types } from 'mongoose';
import { IPaginateModel } from '@/shared/interfaces/model.interface';
import { AuditFields } from '@/shared/types/common';

export enum ClickType {
  WHATSAPP = 'whatsapp',
  COPY_LINK = 'copyLink',
  EMAIL = 'email',
}

export enum ClickAction {
  SHARED = 'shared',
  OPENED = 'opened',
}

export interface QueryFilter {
  type?: ClickType;
  action?: ClickAction;
  propertyId?: string;
  companyId?: string;
  [key: string]: unknown;
}

export interface IClickStatsBase {
  type: ClickType;
  action: ClickAction;
  propertyId: Types.ObjectId | string;
  companyId?: Types.ObjectId | string;
  deviceInfo?: string;
}

export interface IClickStats extends IClickStatsBase, AuditFields {}

export interface IClickStatsDoc extends IClickStats, Document {}

export interface IClickStatsModel extends IPaginateModel<IClickStatsDoc> {}

export type NewCreatedClickStats = Omit<IClickStatsBase, 'createdBy'> &
  Partial<Pick<AuditFields, 'createdBy'>>;

export type UpdateClickStatsBody = Partial<IClickStatsBase>;
