/** * Daily Notification Plugin Definitions * * TypeScript definitions for the Daily Notification Plugin * Aligned with Android implementation and test requirements * * @author Matthew Raymer * @version 2.0.0 */ export interface NotificationResponse { id: string; title: string; body: string; timestamp: number; url?: string; } export interface NotificationOptions { url?: string; time?: string; title?: string; body?: string; sound?: boolean; priority?: 'high' | 'default' | 'low' | 'min' | 'max' | 'normal'; timezone?: string; retryCount?: number; retryInterval?: number; offlineFallback?: boolean; contentHandler?: ContentHandler; headers?: Record; } export interface ContentHandler { (response?: any): Promise<{ title: string; body: string; data?: any }>; } export interface DailyNotificationPlugin { scheduleDailyNotification(options: NotificationOptions | ScheduleOptions): Promise; getLastNotification(): Promise; cancelAllNotifications(): Promise; getNotificationStatus(): Promise; updateSettings(settings: NotificationSettings): Promise; getBatteryStatus(): Promise; requestBatteryOptimizationExemption(): Promise; setAdaptiveScheduling(options: { enabled: boolean }): Promise; getPowerState(): Promise; checkPermissions(): Promise; requestPermissions(): Promise; } export interface ScheduleOptions { url?: string; time?: string; sound?: boolean; priority?: 'high' | 'default' | 'low' | 'min' | 'max' | 'normal'; timezone?: string; retryCount?: number; retryInterval?: number; offlineFallback?: boolean; contentHandler?: ContentHandler; headers?: Record; } export interface NotificationSettings { url?: string; time?: string; sound?: boolean; priority?: string; timezone?: string; retryCount?: number; retryInterval?: number; offlineFallback?: boolean; } export interface NotificationStatus { isEnabled?: boolean; isScheduled?: boolean; lastNotificationTime: number | Promise; nextNotificationTime: number | Promise; pending?: number; settings: NotificationSettings; error?: string; } export interface BatteryStatus { level: number; isCharging: boolean; powerState: number; isOptimizationExempt: boolean; } export interface PowerState { powerState: number; isOptimizationExempt: boolean; } export interface NotificationEvent extends Event { detail: { id: string; action: string; data?: any; }; } export interface PermissionStatus { status?: string; granted?: boolean; notifications: PermissionState; backgroundRefresh?: PermissionState; // iOS only alert?: boolean; badge?: boolean; sound?: boolean; lockScreen?: boolean; carPlay?: boolean; } export type PermissionState = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied' | 'provisional' | 'ephemeral' | 'unknown'; // Additional interfaces for enhanced functionality export interface NotificationMetrics { scheduledTime: number; actualDeliveryTime?: number; contentAge: number; engagement?: 'TAPPED' | 'DISMISSED' | 'IGNORED'; failureReason?: string; platformInfo: PlatformInfo; } export interface PlatformInfo { oem?: string; osVersion: string; appState: string; } export interface FallbackContent { title: string; body: string; isEmergency: boolean; age?: string; } export interface CachePolicy { maxSize: number; evictionPolicy: 'LRU' | 'FIFO' | 'TTL'; ttl?: number; cleanupInterval: number; } export interface NetworkConfig { timeout: number; retryAttempts: number; retryDelay: number; offlineFallback: boolean; } export interface SchedulingConfig { exactAlarms: boolean; adaptiveScheduling: boolean; quietHours?: { start: string; end: string; enabled: boolean; }; timezone: string; }