/**
 * Push Notification DTOs
 *
 * @module Mobile
 */

import { PushProvider } from '../entities/push-token.entity';
import { PushNotificationCategory, PushNotificationStatus } from '../entities/push-notification-log.entity';

export class RegisterPushTokenDto {
  userId: string;
  deviceId: string;
  tenantId: string;
  token: string;
  platform: string;
  provider?: PushProvider;
}

export class UpdatePushTokenDto {
  token?: string;
  isActive?: boolean;
  isValid?: boolean;
  invalidReason?: string;
}

export class SubscribeTopicsDto {
  topics: string[];
}

export class SendPushNotificationDto {
  userId?: string;
  deviceId?: string;
  title: string;
  body?: string;
  data?: Record<string, any>;
  category?: PushNotificationCategory;
}

export class SendBulkNotificationDto {
  userIds?: string[];
  topic?: string;
  title: string;
  body?: string;
  data?: Record<string, any>;
  category?: PushNotificationCategory;
}

export class PushTokenResponseDto {
  id: string;
  userId: string;
  deviceId: string;
  platform: string;
  provider: PushProvider;
  isActive: boolean;
  isValid: boolean;
  subscribedTopics: string[];
  lastUsedAt?: Date;
  createdAt: Date;
}

export class PushNotificationLogResponseDto {
  id: string;
  tenantId: string;
  userId?: string;
  deviceId?: string;
  title: string;
  body?: string;
  category?: PushNotificationCategory;
  status: PushNotificationStatus;
  sentAt: Date;
  deliveredAt?: Date;
  readAt?: Date;
  errorMessage?: string;
}

export class NotificationFilterDto {
  userId?: string;
  deviceId?: string;
  category?: PushNotificationCategory;
  status?: PushNotificationStatus;
  startDate?: Date;
  endDate?: Date;
  limit?: number;
  offset?: number;
}

export class NotificationStatsDto {
  total: number;
  byStatus: Record<PushNotificationStatus, number>;
  byCategory: Record<string, number>;
  deliveryRate: number;
  readRate: number;
}
