import { Injectable, inject } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { environment } from '@environments/environment'; import { Observable } from 'rxjs'; export interface Notification { id: string; type: 'SMS' | 'EMAIL' | 'PUSH' | 'SYSTEM'; title: string; message: string; recipient: string; status: 'SENT' | 'DELIVERED' | 'FAILED' | 'PENDING'; createdAt: Date; sentAt?: Date; errorMessage?: string; } export interface NotificationFilter { type?: string; status?: string; startDate?: Date; endDate?: Date; recipient?: string; } @Injectable({ providedIn: 'root' }) export class NotificationService { private http = inject(HttpClient); private apiUrl = `${environment.localServiceTestApiUrl}/notifications`; getNotifications(filters?: NotificationFilter): Observable { return this.http.post( `${this.apiUrl}/list`, filters ); } sendNotification(notification: Partial): Observable { return this.http.post( `${this.apiUrl}/send`, notification ); } getNotificationStats(): Observable { return this.http.get(`${this.apiUrl}/stats`); } retryNotification(notificationId: string): Observable { return this.http.post( `${this.apiUrl}/${notificationId}/retry`, {} ); } }