import 'package:json_annotation/json_annotation.dart';

part 'upload_info.g.dart';

/// 上传信息
@JsonSerializable()
class UploadInfo {
  /// 唯一id
  @JsonKey(name: "id")
  String? id;

  /// 文件名称
  @JsonKey(name: "fileName")
  String? fileName;

  /// 文件的绝对路径
  @JsonKey(name: "filePath")
  String? filePath;

  /// 文件场景类型
  @JsonKey(name: "uploadSceneType")
  String? uploadSceneType;

  /// 上传状态
  @JsonKey(name: "uploadState")
  String? uploadState;

  /// 文件的远程访问Url，上传成功后赋值
  @JsonKey(name: "fileUrl")
  String? fileUrl;

  /// 文件的cdn前缀，上传成功后赋值
  @JsonKey(name: "fileUrlCdnPrefix")
  String? fileUrlCdnPrefix;

  /// 后端需要用的路径，不包含cdn前缀
  @JsonKey(name: "fileBackendPath")
  String? fileBackendPath;

  UploadInfo({
    this.id,
    this.fileName,
    this.filePath,
    this.uploadSceneType,
    this.uploadState,
    this.fileBackendPath,
  });

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

  factory UploadInfo.fromJson(Map<String, dynamic> json) =>
      _$UploadInfoFromJson(json);
}
