package com.platform.modules.live.vo;

import com.baomidou.mybatisplus.annotations.TableField;
import com.platform.modules.live.entity.LiveReportEntity;
import com.platform.modules.live.utils.ReportReleaseEnum;
import com.platform.modules.live.utils.ReportTypeEnum;
import com.platform.modules.live.utils.TopEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.NotBlank;

import java.util.Date;

/**
 * Description:
 * Author:zj
 * Date:2019/3/2 16:29
 */
@Data
@NoArgsConstructor
public class LiveReportVo {
    @ApiModelProperty(value = "id")
    private Integer id;
    //现场ID
    @ApiModelProperty(value = "现场ID", required = true)
    private Integer sceneId;
    //报道类型 1视频 2音频 3图文 4文字
    @ApiModelProperty(value = "报道类型 1视频 2音频 3图文 4文字", required = true)
    private Integer reportType;
    private String reportTypeStr;
    //报道标题
    @ApiModelProperty(value = "报道标题", hidden=true)
    private String title;
    //报道记者ID
    @ApiModelProperty(value = "报道记者ID", hidden=true)
    private Long userId;
    //图片路径，多张用,分割
    @ApiModelProperty(value = "图片路径，多张用,分割")
    private String[] imgList;
    //视频、音频回看URL地址
    @ApiModelProperty(value = "视频、音频回看URL地址")
    private String mediaUrl;
    //报道内容
    @ApiModelProperty(value = "报道内容")
    private String content;
    //报道时间
    @ApiModelProperty(value = "报道时间")
    private Date reportDate;
    //创建时间
    @ApiModelProperty(value = "创建时间")
    private Date createDate;
    //是否发布 0未发布 1 已发布
    @ApiModelProperty(value = "是否发布 0未发布 1 已发布")
    private Integer isRelease;
    //是否置顶 0未置顶 1 置顶
    @ApiModelProperty(value = "是否置顶 0未置顶 1 置顶")
    private Integer isTop;
    //排序，数字越大，排序越靠前
    @ApiModelProperty(value = "排序，数字越大，排序越靠前")
    private Integer priority;
    //发布人
    @ApiModelProperty(value = "发布人Id", hidden=true)
    private Long releaseUser;
    //发布时间
    @ApiModelProperty(value = "发布时间")
    private Date releaseDate;
    //最后操作人
    @ApiModelProperty(value = "最后操作人", hidden=true)
    private Long lastUpdateUser;
    //最后操作时间
    @ApiModelProperty(value = "最后操作时间")
    private Date lastUpdateDate;
    //音视频时长
    @ApiModelProperty(value = "音视频时长")
    private Long fileDuration;
    //文件大小
    @ApiModelProperty(value = "文件大小")
    private Long fileSize;

    @ApiModelProperty(value = "记者名")
    private String reporterName;
    @TableField(exist=false)
    @ApiModelProperty(value = "最后操作人")
    private String lastUpdateUserName;
    @TableField(exist=false)
    @ApiModelProperty(value = "发布人")
    private String releaseUserName;
    private String isReleaseShow;
    private String isTopShow;

    public LiveReportVo(LiveReportEntity entity) {
        this.content = entity.getContent();
        this.createDate = entity.getCreateDate();
        this.fileDuration = entity.getFileDuration();
        this.fileSize = entity.getFileSize();
        this.id = entity.getId();
        this.isRelease = entity.getIsRelease();
        this.isTop = entity.getIsTop();
        this.lastUpdateDate = entity.getLastUpdateDate();
        this.lastUpdateUser = entity.getLastUpdateUser();
        this.lastUpdateUserName = entity.getLastUpdateUserName();
        this.priority = entity.getPriority();
        this.releaseDate = entity.getReleaseDate();
        this.releaseUser = entity.getReleaseUser();
        this.releaseUserName = entity.getReleaseUserName();
        this.reportType = entity.getReportType();
        this.reportDate = entity.getReportDate();
        this.sceneId = entity.getSceneId();
        this.title = entity.getTitle();
        this.userId = entity.getUserId();
        if (entity.getReportType() != null)
            this.reportTypeStr = ReportTypeEnum.getName(entity.getReportType());
        if (entity.getIsRelease() != null)
            this.isReleaseShow = ReportReleaseEnum.getName(entity.getIsRelease());
        if (entity.getIsTop() != null)
            this.isTopShow = TopEnum.getName(entity.getIsTop());
    }
}
