package com.tuoheng.admin.entity.request;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 回调请求体
 *
 * @author chenyukun
 * @since 2022-06-14
 */
@Data
@Accessors(chain = true)
public class CallbackRequest  implements Serializable {

    private static final long serialVersionUID = 1L;
    /**
     * 分析状态
     */
    @NotNull
    private Integer analyseStatus;

    /**
     * 错误信息
     */
    @Length(max = 255)
    private String errorCode;

    /**
     * 错误信息
     */
    @Length(max = 255)
    private String errorMsg;

    /**
     * 分析类型：1：实时 2：离线
     */
    @NotNull
    private Integer type;

    /**
     * 进度
     */
    private Double progress;

    /**
     * 原视频地址
     */
    @Pattern(regexp = "^[\\u4E00-\\u9FA5A-Za-z0-9_.\\-:/]{0,255}$")
    private String videoUrl;

    /**
     * ai视频地址
     */
    @Pattern(regexp = "^[\\u4E00-\\u9FA5A-Za-z0-9_.\\-:/]{0,255}$")
    private String aiVideoUrl;

    /**
     * 问题集
     */
    List<@Valid QuestionFilesDTO> questionFiles;

    @NoArgsConstructor
    @Data
    public static class QuestionFilesDTO {
        @ApiModelProperty(value = "文件code")
        private String fileCode;
        @ApiModelProperty(value = "文件名称")
        private String fileName;
        @ApiModelProperty(value = "原文件")
        private String fileOriginalUrl;
        @ApiModelProperty(value = "标记后的文件")
        private String fileMarkerUrl;

        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        @ApiModelProperty(value = "分析时间")
        private Date analyseTime;

        @ApiModelProperty(value = "问题类型")
        private String questionCode;

        @ApiModelProperty(value = "问题名称")
        private String questionName;
        @ApiModelProperty(value = "问题描述")
        private String questionDesc;
    }
}
