class SystemNotificationModel {
  String? userId;
  String? userName;
  String? title;
  String? text;
  int? referenceId;
  int? sourceId;
  String? sourceName;
  bool? readed;
  String? readingDate;
  int? id;
  String? createdOn;
  String? modifiedOn;
  String? priorityName;
  String? statusName;
  int ? transactionType;

  SystemNotificationModel(
      {this.userId,
      this.userName,
      this.title,
      this.text,
      this.referenceId,
      this.sourceId,
      this.sourceName,
      this.readed,
      this.readingDate,
      this.id,
      this.createdOn,
      this.modifiedOn,
      this.priorityName,
        this.transactionType,
      this.statusName});

  SystemNotificationModel.fromJson(Map<String, dynamic>? json) {
    // Allow json to be null
    if (json != null) {
      // Add null check
      userId = json['userId'];
      userName = json['userName'];
      title = json['title'];
      text = json['text'];
      referenceId = json['referenceId'];
      sourceId = json['sourceId'];
      sourceName = json['sourceName'];
      readed = json['readed'];
      readingDate = json['readingDate'];
      id = json['id'];
      createdOn = json['createdOn'];
      modifiedOn = json['modifiedOn'];
      priorityName = json['priorityName'];
      statusName = json['statusName'];
      transactionType = json['transactionType'];
    }
  }

  Map<String, dynamic> toNotificationJson() {
    final Map<String, dynamic> data = <String, dynamic>{}; // Use <String, dynamic> for type safety
    data['userId'] = userId;
    data['userName'] = userName;
    data['title'] = title;
    data['text'] = text;
    data['requestNumber'] = referenceId;
    data['sourceId'] = sourceId;
    data['requestType'] = sourceName;
    data['readed'] = readed;
    data['readingDate'] = readingDate;
    data['id'] = id;
    data['createdOn'] = createdOn;
    data['modifiedOn'] = modifiedOn;
    data['priorityName'] = priorityName;
    data['priority'] = priorityName;
    data['statusName'] = statusName;
    data['transactionType'] = transactionType;
    return data;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{}; // Use <String, dynamic> for type safety
    data['userId'] = userId;
    data['userName'] = userName;
    data['title'] = title;
    data['text'] = text;
    data['referenceId'] = referenceId;
    data['sourceId'] = sourceId;
    data['sourceName'] = sourceName;
    data['readed'] = readed;
    data['readingDate'] = readingDate;
    data['id'] = id;
    data['createdOn'] = createdOn;
    data['modifiedOn'] = modifiedOn;
    data['priorityName'] = priorityName;
    data['statusName'] = statusName;
    data['transactionType'] = transactionType;
    return data;
  }
}
