// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'script_widget.dart';

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

_ScriptWidgetOption _$ScriptWidgetOptionFromJson(Map<String, dynamic> json) =>
    _ScriptWidgetOption(
      title: json['title'] as String? ?? '',
      value: json['value'] == null ? '' : _stringFromAny(json['value']),
    );

Map<String, dynamic> _$ScriptWidgetOptionToJson(_ScriptWidgetOption instance) =>
    <String, dynamic>{'title': instance.title, 'value': instance.value};

_ScriptWidgetBelongTo _$ScriptWidgetBelongToFromJson(
  Map<String, dynamic> json,
) => _ScriptWidgetBelongTo(
  paramName: json['paramName'] as String? ?? '',
  value: json['value'] == null
      ? const <String>[]
      : _stringListFromAny(json['value']),
);

Map<String, dynamic> _$ScriptWidgetBelongToToJson(
  _ScriptWidgetBelongTo instance,
) => <String, dynamic>{
  'paramName': instance.paramName,
  'value': instance.value,
};

_ScriptWidgetParam _$ScriptWidgetParamFromJson(
  Map<String, dynamic> json,
) => _ScriptWidgetParam(
  name: json['name'] as String,
  title: json['title'] as String? ?? '',
  type: json['type'] as String? ?? 'input',
  description: json['description'] as String? ?? '',
  value: json['value'],
  belongTo: json['belongTo'] == null
      ? null
      : ScriptWidgetBelongTo.fromJson(json['belongTo'] as Map<String, dynamic>),
  placeholders:
      (json['placeholders'] as List<dynamic>?)
          ?.map((e) => ScriptWidgetOption.fromJson(e as Map<String, dynamic>))
          .toList() ??
      const <ScriptWidgetOption>[],
  enumOptions:
      (json['enumOptions'] as List<dynamic>?)
          ?.map((e) => ScriptWidgetOption.fromJson(e as Map<String, dynamic>))
          .toList() ??
      const <ScriptWidgetOption>[],
);

Map<String, dynamic> _$ScriptWidgetParamToJson(_ScriptWidgetParam instance) =>
    <String, dynamic>{
      'name': instance.name,
      'title': instance.title,
      'type': instance.type,
      'description': instance.description,
      'value': instance.value,
      'belongTo': instance.belongTo,
      'placeholders': instance.placeholders,
      'enumOptions': instance.enumOptions,
    };

_ScriptWidgetModule _$ScriptWidgetModuleFromJson(Map<String, dynamic> json) =>
    _ScriptWidgetModule(
      id: json['id'] as String? ?? '',
      title: json['title'] as String,
      description: json['description'] as String? ?? '',
      requiresWebView: json['requiresWebView'] as bool? ?? false,
      functionName: json['functionName'] as String,
      sectionMode: json['sectionMode'] as bool? ?? false,
      cacheDuration: (json['cacheDuration'] as num?)?.toInt() ?? 3600,
      type: json['type'] as String? ?? 'list',
      params:
          (json['params'] as List<dynamic>?)
              ?.map(
                (e) => ScriptWidgetParam.fromJson(e as Map<String, dynamic>),
              )
              .toList() ??
          const <ScriptWidgetParam>[],
    );

Map<String, dynamic> _$ScriptWidgetModuleToJson(_ScriptWidgetModule instance) =>
    <String, dynamic>{
      'id': instance.id,
      'title': instance.title,
      'description': instance.description,
      'requiresWebView': instance.requiresWebView,
      'functionName': instance.functionName,
      'sectionMode': instance.sectionMode,
      'cacheDuration': instance.cacheDuration,
      'type': instance.type,
      'params': instance.params,
    };

_ScriptWidgetManifest _$ScriptWidgetManifestFromJson(
  Map<String, dynamic> json,
) => _ScriptWidgetManifest(
  id: json['id'] as String,
  title: json['title'] as String,
  description: json['description'] as String? ?? '',
  author: json['author'] as String? ?? '',
  site: json['site'] as String? ?? '',
  version: json['version'] as String? ?? '0.0.0',
  requiredVersion: json['requiredVersion'] as String? ?? '0.0.1',
  detailCacheDuration: (json['detailCacheDuration'] as num?)?.toInt() ?? 60,
  globalParams:
      (json['globalParams'] as List<dynamic>?)
          ?.map((e) => ScriptWidgetParam.fromJson(e as Map<String, dynamic>))
          .toList() ??
      const <ScriptWidgetParam>[],
  modules:
      (json['modules'] as List<dynamic>?)
          ?.map((e) => ScriptWidgetModule.fromJson(e as Map<String, dynamic>))
          .toList() ??
      const <ScriptWidgetModule>[],
  search: json['search'] == null
      ? null
      : ScriptWidgetModule.fromJson(json['search'] as Map<String, dynamic>),
);

Map<String, dynamic> _$ScriptWidgetManifestToJson(
  _ScriptWidgetManifest instance,
) => <String, dynamic>{
  'id': instance.id,
  'title': instance.title,
  'description': instance.description,
  'author': instance.author,
  'site': instance.site,
  'version': instance.version,
  'requiredVersion': instance.requiredVersion,
  'detailCacheDuration': instance.detailCacheDuration,
  'globalParams': instance.globalParams,
  'modules': instance.modules,
  'search': instance.search,
};

_ScriptVideoPerson _$ScriptVideoPersonFromJson(Map<String, dynamic> json) =>
    _ScriptVideoPerson(
      id: json['id'] == null ? '' : _stringFromAny(json['id']),
      title: json['title'] as String? ?? '',
      avatar: json['avatar'] as String? ?? '',
      role: json['role'] as String? ?? '',
    );

Map<String, dynamic> _$ScriptVideoPersonToJson(_ScriptVideoPerson instance) =>
    <String, dynamic>{
      'id': instance.id,
      'title': instance.title,
      'avatar': instance.avatar,
      'role': instance.role,
    };

_ScriptVideoGenre _$ScriptVideoGenreFromJson(Map<String, dynamic> json) =>
    _ScriptVideoGenre(
      id: json['id'] == null ? '' : _stringFromAny(json['id']),
      title: json['title'] as String? ?? '',
    );

Map<String, dynamic> _$ScriptVideoGenreToJson(_ScriptVideoGenre instance) =>
    <String, dynamic>{'id': instance.id, 'title': instance.title};

_ScriptVideoTrailer _$ScriptVideoTrailerFromJson(Map<String, dynamic> json) =>
    _ScriptVideoTrailer(
      coverUrl: json['coverUrl'] as String? ?? '',
      url: json['url'] as String? ?? '',
    );

Map<String, dynamic> _$ScriptVideoTrailerToJson(_ScriptVideoTrailer instance) =>
    <String, dynamic>{'coverUrl': instance.coverUrl, 'url': instance.url};

_ScriptVideoItem _$ScriptVideoItemFromJson(
  Map<String, dynamic> json,
) => _ScriptVideoItem(
  id: _stringFromAny(json['id']),
  type: json['type'] as String? ?? 'link',
  title: json['title'] as String? ?? '',
  coverUrl: json['coverUrl'] as String? ?? '',
  posterPath: _readPosterPath(json, 'posterPath') as String? ?? '',
  detailPoster: json['detailPoster'] as String? ?? '',
  backdropPath: json['backdropPath'] as String? ?? '',
  backdropPaths:
      (json['backdropPaths'] as List<dynamic>?)
          ?.map((e) => e as String)
          .toList() ??
      const <String>[],
  releaseDate: json['releaseDate'] as String? ?? '',
  mediaType: json['mediaType'] as String? ?? '',
  rating: _doubleFromAny(json['rating']),
  genreTitle: json['genreTitle'] as String? ?? '',
  genreItems:
      (json['genreItems'] as List<dynamic>?)
          ?.map((e) => ScriptVideoGenre.fromJson(e as Map<String, dynamic>))
          .toList() ??
      const <ScriptVideoGenre>[],
  peoples:
      (json['peoples'] as List<dynamic>?)
          ?.map((e) => ScriptVideoPerson.fromJson(e as Map<String, dynamic>))
          .toList() ??
      const <ScriptVideoPerson>[],
  duration: _intFromAny(json['duration']),
  durationText: json['durationText'] as String? ?? '',
  previewUrl: json['previewUrl'] as String? ?? '',
  trailers:
      (json['trailers'] as List<dynamic>?)
          ?.map((e) => ScriptVideoTrailer.fromJson(e as Map<String, dynamic>))
          .toList() ??
      const <ScriptVideoTrailer>[],
  videoUrl: json['videoUrl'] as String? ?? '',
  link: json['link'] as String? ?? '',
  episode: _intFromAny(json['episode']),
  description: json['description'] as String? ?? '',
  playerType: json['playerType'] as String? ?? 'app',
  childItems:
      (json['childItems'] as List<dynamic>?)
          ?.map((e) => ScriptVideoItem.fromJson(e as Map<String, dynamic>))
          .toList() ??
      const <ScriptVideoItem>[],
  episodeItems:
      (json['episodeItems'] as List<dynamic>?)
          ?.map((e) => ScriptVideoItem.fromJson(e as Map<String, dynamic>))
          .toList() ??
      const <ScriptVideoItem>[],
  relatedItems:
      (json['relatedItems'] as List<dynamic>?)
          ?.map((e) => ScriptVideoItem.fromJson(e as Map<String, dynamic>))
          .toList() ??
      const <ScriptVideoItem>[],
);

Map<String, dynamic> _$ScriptVideoItemToJson(_ScriptVideoItem instance) =>
    <String, dynamic>{
      'id': instance.id,
      'type': instance.type,
      'title': instance.title,
      'coverUrl': instance.coverUrl,
      'posterPath': instance.posterPath,
      'detailPoster': instance.detailPoster,
      'backdropPath': instance.backdropPath,
      'backdropPaths': instance.backdropPaths,
      'releaseDate': instance.releaseDate,
      'mediaType': instance.mediaType,
      'rating': instance.rating,
      'genreTitle': instance.genreTitle,
      'genreItems': instance.genreItems,
      'peoples': instance.peoples,
      'duration': instance.duration,
      'durationText': instance.durationText,
      'previewUrl': instance.previewUrl,
      'trailers': instance.trailers,
      'videoUrl': instance.videoUrl,
      'link': instance.link,
      'episode': instance.episode,
      'description': instance.description,
      'playerType': instance.playerType,
      'childItems': instance.childItems,
      'episodeItems': instance.episodeItems,
      'relatedItems': instance.relatedItems,
    };

_ScriptVideoResource _$ScriptVideoResourceFromJson(Map<String, dynamic> json) =>
    _ScriptVideoResource(
      name: json['name'] as String? ?? '',
      description: json['description'] as String? ?? '',
      url: json['url'] as String,
      customHeaders:
          (_readResourceHeaders(json, 'customHeaders') as Map<String, dynamic>?)
              ?.map((k, e) => MapEntry(k, e as String)) ??
          const <String, String>{},
      playerType: json['playerType'] as String? ?? 'app',
    );

Map<String, dynamic> _$ScriptVideoResourceToJson(
  _ScriptVideoResource instance,
) => <String, dynamic>{
  'name': instance.name,
  'description': instance.description,
  'url': instance.url,
  'customHeaders': instance.customHeaders,
  'playerType': instance.playerType,
};

_InstalledScriptWidget _$InstalledScriptWidgetFromJson(
  Map<String, dynamic> json,
) => _InstalledScriptWidget(
  manifest: ScriptWidgetManifest.fromJson(
    json['manifest'] as Map<String, dynamic>,
  ),
  scriptSource: json['scriptSource'] as String,
  sourceUrl: json['sourceUrl'] as String? ?? '',
  enabled: json['enabled'] as bool? ?? true,
  globalParams:
      json['globalParams'] as Map<String, dynamic>? ??
      const <String, Object?>{},
  installedAt: DateTime.parse(json['installedAt'] as String),
  updatedAt: DateTime.parse(json['updatedAt'] as String),
);

Map<String, dynamic> _$InstalledScriptWidgetToJson(
  _InstalledScriptWidget instance,
) => <String, dynamic>{
  'manifest': instance.manifest,
  'scriptSource': instance.scriptSource,
  'sourceUrl': instance.sourceUrl,
  'enabled': instance.enabled,
  'globalParams': instance.globalParams,
  'installedAt': instance.installedAt.toIso8601String(),
  'updatedAt': instance.updatedAt.toIso8601String(),
};

_ScriptWidgetCatalogEntry _$ScriptWidgetCatalogEntryFromJson(
  Map<String, dynamic> json,
) => _ScriptWidgetCatalogEntry(
  id: json['id'] as String,
  title: json['title'] as String,
  description: json['description'] as String? ?? '',
  requiredVersion: json['requiredVersion'] as String? ?? '',
  version: json['version'] as String? ?? '',
  author: json['author'] as String? ?? '',
  url: json['url'] as String,
);

Map<String, dynamic> _$ScriptWidgetCatalogEntryToJson(
  _ScriptWidgetCatalogEntry instance,
) => <String, dynamic>{
  'id': instance.id,
  'title': instance.title,
  'description': instance.description,
  'requiredVersion': instance.requiredVersion,
  'version': instance.version,
  'author': instance.author,
  'url': instance.url,
};

_ScriptWidgetCatalog _$ScriptWidgetCatalogFromJson(Map<String, dynamic> json) =>
    _ScriptWidgetCatalog(
      title: json['title'] as String,
      description: json['description'] as String? ?? '',
      icon: json['icon'] as String? ?? '',
      widgets:
          (json['widgets'] as List<dynamic>?)
              ?.map(
                (e) => ScriptWidgetCatalogEntry.fromJson(
                  e as Map<String, dynamic>,
                ),
              )
              .toList() ??
          const <ScriptWidgetCatalogEntry>[],
    );

Map<String, dynamic> _$ScriptWidgetCatalogToJson(
  _ScriptWidgetCatalog instance,
) => <String, dynamic>{
  'title': instance.title,
  'description': instance.description,
  'icon': instance.icon,
  'widgets': instance.widgets,
};

_ScriptWidgetSubscription _$ScriptWidgetSubscriptionFromJson(
  Map<String, dynamic> json,
) => _ScriptWidgetSubscription(
  url: json['url'] as String,
  catalog: ScriptWidgetCatalog.fromJson(
    json['catalog'] as Map<String, dynamic>,
  ),
  refreshedAt: DateTime.parse(json['refreshedAt'] as String),
);

Map<String, dynamic> _$ScriptWidgetSubscriptionToJson(
  _ScriptWidgetSubscription instance,
) => <String, dynamic>{
  'url': instance.url,
  'catalog': instance.catalog,
  'refreshedAt': instance.refreshedAt.toIso8601String(),
};
