import 'package:novyronst/common/model/parse_model.dart'; class NyEpisodeModel { final int id; final int shortId; final int shortPlayId; final int shortPlayVideoId; final int episode; final String videoUrl; final int? promiseViewAd; final int iaaPopUp; bool isLock; String playSeconds; int? viewAdCount; NyEpisodeModel({ required this.id, required this.shortId, required this.shortPlayId, required this.shortPlayVideoId, required this.episode, required this.videoUrl, required this.playSeconds, required this.isLock, this.promiseViewAd, required this.iaaPopUp, required this.viewAdCount, }); factory NyEpisodeModel.fromJson(Map json) { return NyEpisodeModel( id: parseInt(json['id']), shortId: parseInt(json['short_id']), shortPlayId: parseInt(json['short_play_id']), shortPlayVideoId: parseInt(json['short_play_video_id']), episode: parseInt(json['episode']), videoUrl: parseString(json['video_url']), playSeconds: parseString(json['play_seconds']), isLock: parseBool(json['is_lock']), promiseViewAd: json['promise_view_ad'] == null ? null : parseInt(json['promise_view_ad']), iaaPopUp: parseInt(json['iaa_pop_up']), viewAdCount: parseInt(json['view_ad_count']), ); } Map toJson() { return { 'id': id, 'short_id': shortId, 'short_play_id': shortPlayId, 'short_play_video_id': shortPlayVideoId, 'episode': episode, 'video_url': videoUrl, 'promise_view_ad': promiseViewAd, 'iaa_pop_up': iaaPopUp, 'is_lock': isLock, 'play_seconds': playSeconds, 'view_ad_count': viewAdCount, }; } NyEpisodeModel copyWith({ int? id, int? shortId, int? shortPlayId, int? shortPlayVideoId, int? episode, String? videoUrl, bool? isLock, String? playSeconds, String? durationSeconds, int? promiseViewAd, int? viewAdCount, int? iaaPopUp, }) { return NyEpisodeModel( id: id ?? this.id, shortId: shortId ?? this.shortId, shortPlayId: shortPlayId ?? this.shortPlayId, shortPlayVideoId: shortPlayVideoId ?? this.shortPlayVideoId, episode: episode ?? this.episode, videoUrl: videoUrl ?? this.videoUrl, isLock: isLock ?? this.isLock, playSeconds: playSeconds ?? this.playSeconds, promiseViewAd: promiseViewAd ?? this.promiseViewAd, viewAdCount: viewAdCount ?? this.viewAdCount, iaaPopUp: iaaPopUp ?? this.iaaPopUp, ); } }