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

ServiceTimePeriodEntity $ServiceTimePeriodEntityFromJson(Map<String, dynamic> json) {
  final ServiceTimePeriodEntity serviceTimePeriodEntity = ServiceTimePeriodEntity();
  final String? timeText = jsonConvert.convert<String>(json['time_text']);
  if (timeText != null) {
    serviceTimePeriodEntity.timeText = timeText;
  }
  final String? time = jsonConvert.convert<String>(json['time']);
  if (time != null) {
    serviceTimePeriodEntity.time = time;
  }
  final bool? urgent = jsonConvert.convert<bool>(json['urgent']);
  if (urgent != null) {
    serviceTimePeriodEntity.urgent = urgent;
  }
  final bool? holiday = jsonConvert.convert<bool>(json['holiday']);
  if (holiday != null) {
    serviceTimePeriodEntity.holiday = holiday;
  }
  final bool? night = jsonConvert.convert<bool>(json['night']);
  if (night != null) {
    serviceTimePeriodEntity.night = night;
  }
  final bool? enable = jsonConvert.convert<bool>(json['enable']);
  if (enable != null) {
    serviceTimePeriodEntity.enable = enable;
  }
  return serviceTimePeriodEntity;
}

Map<String, dynamic> $ServiceTimePeriodEntityToJson(ServiceTimePeriodEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['time_text'] = entity.timeText;
  data['time'] = entity.time;
  data['urgent'] = entity.urgent;
  data['holiday'] = entity.holiday;
  data['night'] = entity.night;
  data['enable'] = entity.enable;
  return data;
}

extension ServiceTimePeriodEntityExtension on ServiceTimePeriodEntity {
  ServiceTimePeriodEntity copyWith({
    String? timeText,
    String? time,
    bool? urgent,
    bool? holiday,
    bool? night,
    bool? enable,
  }) {
    return ServiceTimePeriodEntity()
      ..timeText = timeText ?? this.timeText
      ..time = time ?? this.time
      ..urgent = urgent ?? this.urgent
      ..holiday = holiday ?? this.holiday
      ..night = night ?? this.night
      ..enable = enable ?? this.enable;
  }
}