import 'package:json_annotation/json_annotation.dart';

import '../config/request_config.dart';

part 'app_version.g.dart';

@JsonSerializable()
class AppVersion extends Object {
  // @JsonKey(name: 'id')
  // String id;

  // @JsonKey(name: 'creatorId')
  // int creatorId;

  // @JsonKey(name: 'creatorName')
  // String creatorName;

  // @JsonKey(name: 'creationTime')
  // String creationTime;

  @JsonKey(name: 'appName')
  String appName;

  @JsonKey(name: 'version')
  String version;

  @JsonKey(name: 'ftuType')
  int ftuType;

  @JsonKey(name: 'appFileUrl')
  String? appFileUrl;

  @JsonKey(name: 'description')
  String? description;

  AppVersion(
    // this.id,
    // this.creatorId,
    // this.creatorName,
    // this.creationTime,
    this.appName,
    this.version,
    this.ftuType,
    this.appFileUrl,
    this.description,
  ) {
    if (appFileUrl != null && ftuType != 2) {
      appFileUrl = RequestConfig.imgUrl + appFileUrl!;
    }
  }

  factory AppVersion.fromJson(Map<String, dynamic> srcJson) =>
      _$AppVersionFromJson(srcJson);

  Map<String, dynamic> toJson() => _$AppVersionToJson(this);
}
