import { NotificationCode } from "../constant";

/** The user that triggered the notification. */
export interface INotificationFromUser {
  id: number;
  name: string;
  profileImage: string | null;
}

/** Template metadata for a notification type. */
export interface INotificationTemplate {
  id: number;
  code: NotificationCode | string;
  replacements: string;
  title: string;
  body: string;
  bodyText: string;
  notificationImage: string | null;
}

/** Domain payload carried in `replacements.data`. */
export interface INotificationReplacementData {
  code: string;
  title: string;
  answer?: string;
  status?: string;
  answerId?: string;
  questionId?: string;
}

/** Values used to interpolate the notification template. */
export interface INotificationReplacements {
  data: INotificationReplacementData;
  type: string;
  title: string;
  questionId?: string;
}

export interface INotificationLog {
  id: number;
  userId: number;
  notificationId: number;
  fromUserId: number;
  replacements: INotificationReplacements;
  isViewed: boolean;
  isRead: boolean;
  createdAt: string;
  updatedAt: string;
  fromUser: INotificationFromUser;
  notification: INotificationTemplate;
  resolvedData: Record<string, string>;
}

export interface INotificationListResponse {
  page: number;
  perPage: number;
  totalRecords: number;
  totalPages: number;
  data: INotificationLog[];
}

export interface INotificationUnreadCountResponse {
  unreadCount: number;
}
