// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'weather_cubit.dart';

// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************

WeatherState _$WeatherStateFromJson(Map<String, dynamic> json) {
  return $checkedNew('WeatherState', json, () {
    final val = WeatherState(
      status: $checkedConvert(json, 'status',
          (v) => _$enumDecodeNullable(_$WeatherStatusEnumMap, v)),
      temperatureUnits: $checkedConvert(json, 'temperature_units',
          (v) => _$enumDecodeNullable(_$TemperatureUnitsEnumMap, v)),
      weather: $checkedConvert(
          json,
          'weather',
          (v) =>
              v == null ? null : Weather.fromJson(v as Map<String, dynamic>)),
    );
    return val;
  }, fieldKeyMap: const {'temperatureUnits': 'temperature_units'});
}

Map<String, dynamic> _$WeatherStateToJson(WeatherState instance) =>
    <String, dynamic>{
      'status': _$WeatherStatusEnumMap[instance.status],
      'weather': instance.weather?.toJson(),
      'temperature_units': _$TemperatureUnitsEnumMap[instance.temperatureUnits],
    };

T _$enumDecode<T>(
  Map<T, dynamic> enumValues,
  dynamic source, {
  T unknownValue,
}) {
  if (source == null) {
    throw ArgumentError('A value must be provided. Supported values: '
        '${enumValues.values.join(', ')}');
  }

  final value = enumValues.entries
      .singleWhere((e) => e.value == source, orElse: () => null)
      ?.key;

  if (value == null && unknownValue == null) {
    throw ArgumentError('`$source` is not one of the supported values: '
        '${enumValues.values.join(', ')}');
  }
  return value ?? unknownValue;
}

T _$enumDecodeNullable<T>(
  Map<T, dynamic> enumValues,
  dynamic source, {
  T unknownValue,
}) {
  if (source == null) {
    return null;
  }
  return _$enumDecode<T>(enumValues, source, unknownValue: unknownValue);
}

const _$WeatherStatusEnumMap = {
  WeatherStatus.initial: 'initial',
  WeatherStatus.loading: 'loading',
  WeatherStatus.success: 'success',
  WeatherStatus.failure: 'failure',
};

const _$TemperatureUnitsEnumMap = {
  TemperatureUnits.fahrenheit: 'fahrenheit',
  TemperatureUnits.celsius: 'celsius',
};
