// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'warband_roster.dart';

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

HenchmenGroup _$HenchmenGroupFromJson(Map json) {
  $checkKeys(json, requiredKeys: const ['group', 'stats']);
  return HenchmenGroup(
    HenchmenGroup._henchmenHeaderFromJson(json['group'] as String),
    Unit._statsFromJson(json['stats'] as String),
    Unit._splitListFromJson(json['weapons'] as String),
    Unit._splitListFromJson(json['armour'] as String),
    Unit._splitListFromJson(json['rules'] as String),
    json['large'] as bool ?? false,
    json['slowWitted'] as bool ?? false,
    json['mount'] as bool ?? false,
    json['attackanimal'] as bool ?? false,
  );
}

Map<String, dynamic> _$HenchmenGroupToJson(HenchmenGroup instance) =>
    <String, dynamic>{
      'group': HenchmenGroup._henchmengroupHeaderToJson(instance.header),
      'large': instance.large,
      'slowWitted': instance.slowWitted,
      'mount': instance.mount,
      'attackanimal': instance.attackAnimal,
      'stats': Unit._statsToJson(instance.stats),
      'weapons': Unit._joinListToJson(instance.weapons),
      'armour': Unit._joinListToJson(instance.armour),
      'rules': Unit._joinListToJson(instance.rules),
    };

Hero _$HeroFromJson(Map json) {
  $checkKeys(json, requiredKeys: const ['hero', 'stats']);
  return Hero(
    Unit._statsFromJson(json['stats'] as String),
    Unit._splitListFromJson(json['skilllists'] as String),
    Unit._splitListFromJson(json['weapons'] as String),
    Unit._splitListFromJson(json['armour'] as String),
    Unit._splitListFromJson(json['rules'] as String),
    Unit._splitListFromJson(json['injuries'] as String),
    json['warbandaddition'] as int ?? 0,
    json['large'] as bool ?? false,
    Hero._heroHeaderFromJson(json['hero'] as String),
    json['hiredsword'] as bool ?? false,
    json['dramatispersonae'] as bool ?? false,
    json['slowWitted'] as bool ?? false,
  );
}

Map<String, dynamic> _$HeroToJson(Hero instance) => <String, dynamic>{
      'hero': Hero._heroHeaderToJson(instance.header),
      'stats': Unit._statsToJson(instance.stats),
      'skilllists': Unit._joinListToJson(instance.skilllists),
      'weapons': Unit._joinListToJson(instance.weapons),
      'armour': Unit._joinListToJson(instance.armour),
      'rules': Unit._joinListToJson(instance.rules),
      'injuries': Unit._joinListToJson(instance.injuries),
      'warbandaddition': instance.warbandaddition,
      'large': instance.large,
      'slowWitted': instance.slowWitted,
      'hiredsword': instance.hiredSword,
      'dramatispersonae': instance.dramatisPersonae,
    };

WarbandRoster _$WarbandRosterFromJson(Map json) {
  $checkKeys(json, requiredKeys: const [
    'warband',
    'objective',
    'alignment',
    'heros',
    'henchmen'
  ]);
  return WarbandRoster(
    WarbandRoster._warbandNameAndRaceFromJson(json['warband'] as String),
    json['campaign'] as int ?? 0,
    json['objective'] as String,
    json['alignment'] as String,
    json['gc'] as int ?? 0,
    json['shards'] as int ?? 0,
    json['equipment'] as String ?? '',
    json['achievments'] as String ?? '',
    (json['heros'] as List)
        ?.map((e) => e == null ? null : Hero.fromJson(e))
        ?.toList(),
    (json['henchmen'] as List)
        ?.map((e) => e == null ? null : HenchmenGroup.fromJson(e))
        ?.toList(),
    json['playerName'] as String ?? 'Lonely Recluse',
    json['filePath'] as String,
    json['version'] == null ? null : Version.fromJson(json['version']),
    json['unseen'] as bool ?? true,
  )..active = json['active'] as bool ?? true;
}

Map<String, dynamic> _$WarbandRosterToJson(WarbandRoster instance) =>
    <String, dynamic>{
      'warband': WarbandRoster._warbandNameAndRaceToJson(instance.nameAndRace),
      'active': instance.active,
      'campaign': instance.campaignPoints,
      'objective': instance.objective,
      'alignment': instance.alignment,
      'achievments': instance.achievments,
      'gc': instance.gc,
      'shards': instance.shards,
      'equipment': instance.equipment,
      'heros': instance.heros,
      'henchmen': instance.henchmenGroups,
      'playerName': instance.playerName,
      'filePath': instance.filePath,
      'version': instance.version,
      'unseen': instance.unseen,
    };
