// ignore_for_file: invalid_annotation_target

import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:tm_app/data/services/model/error/error_model.dart';
import 'package:tm_app/data/services/model/meta/meta.dart';
import 'package:tm_app/data/services/model/notification_data/notification_recipient.dart';

part 'notification_response_model.freezed.dart';
part 'notification_response_model.g.dart';

@freezed
abstract class NotificationResponseModel with _$NotificationResponseModel {
  const factory NotificationResponseModel({
    required bool? success,
    required String? message,
    required List<NotificationItem>? data,
    required ErrorModel? error,
    required Meta? meta,
  }) = _NotificationResponseModel;

  factory NotificationResponseModel.fromJson(Map<String, Object?> json) =>
      _$NotificationResponseModelFromJson(json);
}

@freezed
abstract class NotificationItem with _$NotificationItem {
  const factory NotificationItem({
    required String? id,
    @JsonKey(name: 'user_id') required String? userId,
    required Recipient? recipient,
    required String? title,
    required String? message,
    required String? link,
    required String? image,
    required String? priority,
    required String? type,
    @JsonKey(name: 'event_type') required String? eventType,
    required String? status,
    required Map<String, dynamic>? methods,
    required Map<String, dynamic>? metadata,
    @JsonKey(name: 'schedule_at') required int? scheduleAt,
    @JsonKey(name: 'created_at') required int? createdAt,
    @JsonKey(name: 'updated_at') required int? updatedAt,
    required bool? seen,
    @JsonKey(name: 'seen_at') required int? seenAt,
    @JsonKey(name: 'is_scheduled') required bool? isScheduled,
    @JsonKey(name: 'scheduled_at') required int? scheduledAt,
  }) = _NotificationItem;

  factory NotificationItem.fromJson(Map<String, Object?> json) =>
      _$NotificationItemFromJson(json);
}
