// SPDX-FileCopyrightText: 2026 FocusFlow contributors
// SPDX-License-Identifier: AGPL-3.0-only

part of '../../notification_adapter.dart';

/// Request to schedule one notification through a platform adapter.
sealed class NotificationRequest {
  /// Creates a notification request.
  factory NotificationRequest({
    required String id,
    required String title,
    required String body,
    required DateTime scheduledDateTimeUtc,
    String payloadJson = '{}',
  }) {
    return _NotificationRequest(
      id: _requiredTrimmed(id, 'id'),
      title: _requiredTrimmed(title, 'title'),
      body: body,
      scheduledDateTimeUtc: scheduledDateTimeUtc.toUtc(),
      payloadJson: payloadJson,
    );
  }

  /// Creates a `NotificationRequest._` instance with the values required by its invariants.
  /// Callers should pass already-normalized scheduler data because validation and defaulting belong at the model or service boundary, not in arbitrary UI code.
  const NotificationRequest._({
    required this.id,
    required this.title,
    required this.body,
    required this.scheduledDateTimeUtc,
    required this.payloadJson,
  });

  /// Stable notification id used for scheduling and cancellation.
  final String id;

  /// User-visible notification title.
  final String title;

  /// User-visible notification body.
  final String body;

  /// UTC instant when the notification should be delivered.
  final DateTime scheduledDateTimeUtc;

  /// Adapter-neutral JSON payload string.
  final String payloadJson;
}
