package cn.reghao.tnb.content.app.vod.model.po;

import cn.reghao.jutil.jdk.web.db.BaseObject;
import cn.reghao.tnb.content.api.constant.VideoStatus;
import cn.reghao.tnb.content.app.vod.model.dto.VideoErrorReport;
import lombok.Getter;
import lombok.NoArgsConstructor;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

/**
 * 视频错误
 *
 * @author reghao
 * @date 2023-08-25 13:01:58
 */
@NoArgsConstructor
@Getter
public class VideoError extends BaseObject<Integer> {
    @NotBlank
    private String videoId;
    @NotNull
    private Integer errorCode;
    @NotNull
    private String errorInfo;
    @NotNull
    private Boolean solved;

    public VideoError(VideoErrorReport videoErrorReport) {
        this.videoId = videoErrorReport.getVideoId();
        this.errorCode = videoErrorReport.getErrorCode();
        this.errorInfo = VideoStatus.getDescByCode(videoErrorReport.getErrorCode());
        this.solved = false;
    }
}
