// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'plex_mappers.dart';

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

PlexRoleDto _$PlexRoleDtoFromJson(Map<String, dynamic> json) => PlexRoleDto(
  id: flexibleInt(json['id']),
  filter: json['filter'] as String?,
  tag: json['tag'] as String,
  tagKey: json['tagKey'] as String?,
  role: json['role'] as String?,
  thumb: json['thumb'] as String?,
  count: flexibleInt(json['count']),
);

PlexMediaVersionDto _$PlexMediaVersionDtoFromJson(Map<String, dynamic> json) =>
    PlexMediaVersionDto(
      id: _flexibleIntOrZero(json['id']),
      videoResolution: readStringField(json, 'videoResolution') as String?,
      videoCodec: readStringField(json, 'videoCodec') as String?,
      bitrate: flexibleInt(json['bitrate']),
      width: flexibleInt(json['width']),
      height: flexibleInt(json['height']),
      container: readStringField(json, 'container') as String?,
      partKey: _readPartKey(json, 'partKey') as String,
      accessible: _readPartAccessible(json, 'accessible') as bool?,
      exists: _readPartExists(json, 'exists') as bool?,
    );

PlexLibraryDto _$PlexLibraryDtoFromJson(Map<String, dynamic> json) =>
    PlexLibraryDto(
      key: readStringField(json, 'key') as String? ?? '',
      title: json['title'] as String? ?? '',
      type: json['type'] as String? ?? '',
      agent: json['agent'] as String?,
      scanner: json['scanner'] as String?,
      language: json['language'] as String?,
      uuid: json['uuid'] as String?,
      updatedAt: flexibleInt(json['updatedAt']),
      createdAt: flexibleInt(json['createdAt']),
      hidden: flexibleInt(json['hidden']),
    );

PlexPlaylistDto _$PlexPlaylistDtoFromJson(Map<String, dynamic> json) =>
    PlexPlaylistDto(
      ratingKey: readStringField(json, 'ratingKey') as String? ?? '',
      key: json['key'] as String? ?? '',
      type: json['type'] as String? ?? '',
      title: json['title'] as String? ?? '',
      summary: json['summary'] as String?,
      smart: json['smart'] as bool? ?? false,
      playlistType: json['playlistType'] as String? ?? '',
      duration: flexibleInt(json['duration']),
      leafCount: flexibleInt(json['leafCount']),
      composite: json['composite'] as String?,
      addedAt: flexibleInt(json['addedAt']),
      updatedAt: flexibleInt(json['updatedAt']),
      lastViewedAt: flexibleInt(json['lastViewedAt']),
      viewCount: flexibleInt(json['viewCount']),
      content: json['content'] as String?,
      guid: json['guid'] as String?,
      thumb: json['thumb'] as String?,
    );

PlexHubDto _$PlexHubDtoFromJson(Map<String, dynamic> json) => PlexHubDto(
  hubKey: readStringField(json, 'key') as String? ?? '',
  title: _hubTitleFromJson(json['title']),
  type: json['type'] as String? ?? 'hub',
  hubIdentifier: json['hubIdentifier'] as String?,
  size: _flexibleIntOrZero(json['size']),
  more: flexibleBool(json['more']),
  items: _hubItemsFromJson(_readHubItems(json, 'items')),
);

PlexMetadataDto _$PlexMetadataDtoFromJson(Map<String, dynamic> json) =>
    PlexMetadataDto(
      ratingKey: _readMetadataRatingKey(json, 'ratingKey') as String? ?? '',
      key: json['key'] as String?,
      guid: json['guid'] as String?,
      studio: json['studio'] as String?,
      type: json['type'] as String?,
      title: json['title'] as String?,
      titleSort: json['titleSort'] as String?,
      contentRating: json['contentRating'] as String?,
      summary: json['summary'] as String?,
      rating: (json['rating'] as num?)?.toDouble(),
      audienceRating: (json['audienceRating'] as num?)?.toDouble(),
      userRating: (json['userRating'] as num?)?.toDouble(),
      year: flexibleInt(json['year']),
      originallyAvailableAt: json['originallyAvailableAt'] as String?,
      thumb: json['thumb'] as String?,
      art: json['art'] as String?,
      duration: flexibleInt(json['duration']),
      addedAt: flexibleInt(json['addedAt']),
      updatedAt: flexibleInt(json['updatedAt']),
      lastViewedAt: flexibleInt(json['lastViewedAt']),
      grandparentTitle: json['grandparentTitle'] as String?,
      grandparentThumb: json['grandparentThumb'] as String?,
      grandparentArt: json['grandparentArt'] as String?,
      grandparentRatingKey:
          readStringField(json, 'grandparentRatingKey') as String?,
      parentTitle: json['parentTitle'] as String?,
      parentThumb: json['parentThumb'] as String?,
      parentRatingKey: readStringField(json, 'parentRatingKey') as String?,
      parentIndex: flexibleInt(json['parentIndex']),
      index: flexibleInt(json['index']),
      grandparentTheme: json['grandparentTheme'] as String?,
      viewOffset: flexibleInt(json['viewOffset']),
      viewCount: flexibleInt(json['viewCount']),
      leafCount: flexibleInt(json['leafCount']),
      viewedLeafCount: flexibleInt(json['viewedLeafCount']),
      childCount: flexibleInt(json['childCount']),
      role: (json['Role'] as List<dynamic>?)
          ?.map((e) => PlexRoleDto.fromJson(e as Map<String, dynamic>))
          .toList(),
      mediaVersions: (json['Media'] as List<dynamic>?)
          ?.map((e) => PlexMediaVersionDto.fromJson(e as Map<String, dynamic>))
          .toList(),
      genre: _tagListFromJson(json['Genre']),
      director: _tagListFromJson(json['Director']),
      writer: _tagListFromJson(json['Writer']),
      producer: _tagListFromJson(json['Producer']),
      country: _tagListFromJson(json['Country']),
      collection: _tagListFromJson(json['Collection']),
      label: _tagListFromJson(json['Label']),
      style: _tagListFromJson(json['Style']),
      mood: _tagListFromJson(json['Mood']),
      audioLanguage: json['audioLanguage'] as String?,
      subtitleLanguage: json['subtitleLanguage'] as String?,
      subtitleMode: flexibleInt(json['subtitleMode']),
      playlistItemID: flexibleInt(json['playlistItemID']),
      playQueueItemID: flexibleInt(json['playQueueItemID']),
      librarySectionID: flexibleInt(json['librarySectionID']),
      librarySectionTitle: json['librarySectionTitle'] as String?,
      ratingImage: json['ratingImage'] as String?,
      audienceRatingImage: json['audienceRatingImage'] as String?,
      tagline: json['tagline'] as String?,
      originalTitle: json['originalTitle'] as String?,
      editionTitle: json['editionTitle'] as String?,
      subtype: json['subtype'] as String?,
      extraType: flexibleInt(json['extraType']),
      primaryExtraKey: json['primaryExtraKey'] as String?,
      clearLogo: json['clearLogo'] as String?,
      backgroundSquare: json['backgroundSquare'] as String?,
      skipChildren: flexibleBoolNullable(json['skipChildren']),
      flattenSeasons: flexibleInt(json['flattenSeasons']),
    );

Map<String, dynamic> _$PlexMetadataDtoToJson(PlexMetadataDto instance) =>
    <String, dynamic>{
      'ratingKey': instance.ratingKey,
      'key': ?instance.key,
      'guid': ?instance.guid,
      'studio': ?instance.studio,
      'type': ?instance.type,
      'title': ?instance.title,
      'titleSort': ?instance.titleSort,
      'contentRating': ?instance.contentRating,
      'summary': ?instance.summary,
      'rating': ?instance.rating,
      'audienceRating': ?instance.audienceRating,
      'userRating': ?instance.userRating,
      'year': ?instance.year,
      'originallyAvailableAt': ?instance.originallyAvailableAt,
      'thumb': ?instance.thumb,
      'art': ?instance.art,
      'duration': ?instance.duration,
      'addedAt': ?instance.addedAt,
      'updatedAt': ?instance.updatedAt,
      'lastViewedAt': ?instance.lastViewedAt,
      'grandparentTitle': ?instance.grandparentTitle,
      'grandparentThumb': ?instance.grandparentThumb,
      'grandparentArt': ?instance.grandparentArt,
      'grandparentRatingKey': ?instance.grandparentRatingKey,
      'parentTitle': ?instance.parentTitle,
      'parentThumb': ?instance.parentThumb,
      'parentRatingKey': ?instance.parentRatingKey,
      'parentIndex': ?instance.parentIndex,
      'index': ?instance.index,
      'grandparentTheme': ?instance.grandparentTheme,
      'viewOffset': ?instance.viewOffset,
      'viewCount': ?instance.viewCount,
      'leafCount': ?instance.leafCount,
      'viewedLeafCount': ?instance.viewedLeafCount,
      'childCount': ?instance.childCount,
      'audioLanguage': ?instance.audioLanguage,
      'subtitleLanguage': ?instance.subtitleLanguage,
      'subtitleMode': ?instance.subtitleMode,
      'playlistItemID': ?instance.playlistItemID,
      'playQueueItemID': ?instance.playQueueItemID,
      'librarySectionID': ?instance.librarySectionID,
      'librarySectionTitle': ?instance.librarySectionTitle,
      'ratingImage': ?instance.ratingImage,
      'audienceRatingImage': ?instance.audienceRatingImage,
      'tagline': ?instance.tagline,
      'originalTitle': ?instance.originalTitle,
      'editionTitle': ?instance.editionTitle,
      'subtype': ?instance.subtype,
      'extraType': ?instance.extraType,
      'primaryExtraKey': ?instance.primaryExtraKey,
      'clearLogo': ?instance.clearLogo,
      'backgroundSquare': ?instance.backgroundSquare,
      'skipChildren': ?instance.skipChildren,
      'flattenSeasons': ?instance.flattenSeasons,
    };
