import 'package:domain/generated/json/base/json_convert_content.dart';
import 'package:domain/entity/rewards_category_entity.dart';

RewardsCategoryEntity $RewardsCategoryEntityFromJson(Map<String, dynamic> json) {
  final RewardsCategoryEntity rewardsCategoryEntity = RewardsCategoryEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    rewardsCategoryEntity.id = id;
  }
  final String? icon = jsonConvert.convert<String>(json['icon']);
  if (icon != null) {
    rewardsCategoryEntity.icon = icon;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    rewardsCategoryEntity.name = name;
  }
  return rewardsCategoryEntity;
}

Map<String, dynamic> $RewardsCategoryEntityToJson(RewardsCategoryEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['icon'] = entity.icon;
  data['name'] = entity.name;
  return data;
}

extension RewardsCategoryEntityExtension on RewardsCategoryEntity {
  RewardsCategoryEntity copyWith({
    int? id,
    String? icon,
    String? name,
  }) {
    return RewardsCategoryEntity()
      ..id = id ?? this.id
      ..icon = icon ?? this.icon
      ..name = name ?? this.name;
  }
}