/**
 * Infrastructure Adapter: InAppNotificationAdapter (Stub)
 * 
 * Handles in-app notifications.
 * Currently a stub - to be implemented when in-app notification system is needed.
 */

import type {
    NotificationDeliveryResult,
    NotificationGateway
} from '@core/notifications/application/ports/NotificationGateway';
import type { Notification } from '@core/notifications/domain/entities/Notification';
import type { NotificationChannel } from '@core/notifications/domain/types/NotificationTypes';

export class InAppNotificationAdapter implements NotificationGateway {
  private readonly channel: NotificationChannel = 'in_app';

  constructor() {
    // In-app notifications don't need external configuration
  }

  async send(notification: Notification): Promise<NotificationDeliveryResult> {
    // In-app notifications are stored in the database, so this is a stub
    // that simulates successful delivery
    console.log(`[InApp Stub] Notification stored in database:`, {
      id: notification.id,
      recipientId: notification.recipientId,
      title: notification.title,
      body: notification.body,
    });

    return {
      success: true,
      channel: this.channel,
      externalId: notification.id.value,
      attemptedAt: new Date(),
    };
  }

  supportsChannel(channel: NotificationChannel): boolean {
    return channel === this.channel;
  }

  isConfigured(): boolean {
    // In-app notifications are always configured
    return true;
  }

  getChannel(): NotificationChannel {
    return this.channel;
  }
}