class NotificationChannelPreference {
  final String channelKey;
  final String channelName;
  final bool isMandatory;
  final bool enabled;

  const NotificationChannelPreference({
    required this.channelKey,
    required this.channelName,
    required this.isMandatory,
    required this.enabled,
  });

  factory NotificationChannelPreference.fromJson(Map<String, dynamic> json) {
    return NotificationChannelPreference(
      channelKey: json['channelKey'] as String? ?? '',
      channelName: json['channelName'] as String? ?? json['channelKey'] as String? ?? '',
      isMandatory: json['isMandatory'] as bool? ?? false,
      enabled: json['enabled'] as bool? ?? true,
    );
  }

  NotificationChannelPreference copyWith({bool? enabled}) {
    return NotificationChannelPreference(
      channelKey: channelKey,
      channelName: channelName,
      isMandatory: isMandatory,
      enabled: enabled ?? this.enabled,
    );
  }
}
