video_entity.dart 1.64 KB
import 'dart:convert';
import 'package:Parlando/generated/json/base/json_field.dart';
import 'package:Parlando/generated/json/video_entity.g.dart';

@JsonSerializable()
class VideoEntity {
  String? status;
  int? code;
  String? message;
  VideoData? data;
  VideoError? error;

  VideoEntity();

  factory VideoEntity.fromJson(Map<String, dynamic> json) =>
      $VideoEntityFromJson(json);

  Map<String, dynamic> toJson() => $VideoEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class VideoData {
  int? id;
  @JSONField(name: "user_id")
  int? userId;
  String? title;
  String? content;
  String? url;
  int? type;
  String? duration;
  String? size;
  @JSONField(name: "poem_id")
  int? poemId;
  @JSONField(name: "temp_id")
  int? tempId;
  String? thumbnail;
  dynamic bgm;
  String? praise;
  String? view;
  String? collect;
  String? share;
  String? comment;
  String? state;
  @JSONField(name: "is_publish")
  String? isPublish;
  @JSONField(name: "is_check")
  String? isCheck;
  @JSONField(name: "created_at")
  String? createdAt;
  @JSONField(name: "updated_at")
  String? updatedAt;

  VideoData();

  factory VideoData.fromJson(Map<String, dynamic> json) =>
      $VideoDataFromJson(json);

  Map<String, dynamic> toJson() => $VideoDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class VideoError {
  VideoError();

  factory VideoError.fromJson(Map<String, dynamic> json) =>
      $VideoErrorFromJson(json);

  Map<String, dynamic> toJson() => $VideoErrorToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}