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

ServiceRepairDetailEntity $ServiceRepairDetailEntityFromJson(Map<String, dynamic> json) {
  final ServiceRepairDetailEntity serviceRepairDetailEntity = ServiceRepairDetailEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    serviceRepairDetailEntity.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    serviceRepairDetailEntity.name = name;
  }
  final String? description = jsonConvert.convert<String>(json['description']);
  if (description != null) {
    serviceRepairDetailEntity.description = description;
  }
  final ServiceRepairDetailMerchant? merchant = jsonConvert.convert<ServiceRepairDetailMerchant>(json['merchant']);
  if (merchant != null) {
    serviceRepairDetailEntity.merchant = merchant;
  }
  final ServiceRepairDetailCategory? category = jsonConvert.convert<ServiceRepairDetailCategory>(json['category']);
  if (category != null) {
    serviceRepairDetailEntity.category = category;
  }
  return serviceRepairDetailEntity;
}

Map<String, dynamic> $ServiceRepairDetailEntityToJson(ServiceRepairDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['description'] = entity.description;
  data['merchant'] = entity.merchant.toJson();
  data['category'] = entity.category.toJson();
  return data;
}

extension ServiceRepairDetailEntityExtension on ServiceRepairDetailEntity {
  ServiceRepairDetailEntity copyWith({
    int? id,
    String? name,
    String? description,
    ServiceRepairDetailMerchant? merchant,
    ServiceRepairDetailCategory? category,
  }) {
    return ServiceRepairDetailEntity()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..description = description ?? this.description
      ..merchant = merchant ?? this.merchant
      ..category = category ?? this.category;
  }
}

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

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

extension ServiceRepairDetailMerchantExtension on ServiceRepairDetailMerchant {
  ServiceRepairDetailMerchant copyWith({
    int? id,
    String? name,
  }) {
    return ServiceRepairDetailMerchant()
      ..id = id ?? this.id
      ..name = name ?? this.name;
  }
}

ServiceRepairDetailCategory $ServiceRepairDetailCategoryFromJson(Map<String, dynamic> json) {
  final ServiceRepairDetailCategory serviceRepairDetailCategory = ServiceRepairDetailCategory();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    serviceRepairDetailCategory.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    serviceRepairDetailCategory.name = name;
  }
  final String? type = jsonConvert.convert<String>(json['type']);
  if (type != null) {
    serviceRepairDetailCategory.type = type;
  }
  return serviceRepairDetailCategory;
}

Map<String, dynamic> $ServiceRepairDetailCategoryToJson(ServiceRepairDetailCategory entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['type'] = entity.type;
  return data;
}

extension ServiceRepairDetailCategoryExtension on ServiceRepairDetailCategory {
  ServiceRepairDetailCategory copyWith({
    int? id,
    String? name,
    String? type,
  }) {
    return ServiceRepairDetailCategory()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..type = type ?? this.type;
  }
}