package com.cool.store.vo.interview;

import com.alibaba.fastjson.JSONObject;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.LineInterviewDO;
import com.cool.store.vo.LineAuditInfoVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Column;
import java.util.Date;
import java.util.List;

@Data
public class InterviewDetailVO {

    @ApiModelProperty("线索id")
    private Long lineId;

    @ApiModelProperty("面试id")
    private Long interviewId;

    @ApiModelProperty("加盟商id")
    private String partnerId;

    @ApiModelProperty("面试官id")
    private String interviewerUserId;

    @ApiModelProperty("面试官姓名")
    private String interviewerUsername;

    @ApiModelProperty("加盟商姓名")
    private String partnerName;

    @ApiModelProperty("区域ID")
    private Long regionId;

    @ApiModelProperty("面试日期")
    private Date interviewDate;

    @ApiModelProperty("面试开始时间")
    private Date startTime;

    @ApiModelProperty("面试结束时间")
    private Date endTime;

    @ApiModelProperty("0未参加，1加盟商先进入 2面试官先进入 3双方都参加")
    private Integer joinInterviewStatus;

    @ApiModelProperty("实际开始时间")
    private Date actualStartTime;

    @ApiModelProperty("实际结束时间")
    private Date actualEndTime;

    @ApiModelProperty("房间号")
    private String roomId;

    @ApiModelProperty("房间密码")
    private String roomPassword;

    @ApiModelProperty("房间状态:0待开放;1已开放; 2已关闭'")
    private Integer roomStatus;

    @ApiModelProperty("面试状态 1待面试 2待审核 3审批通过 4不通过")
    private Integer interviewStatus;

    @ApiModelProperty("面试类型:0面谈，1一审，2二审")
    private Integer interviewType;

    @ApiModelProperty("视频链接")
    private List<String> videoUrl;

    @ApiModelProperty("审核信息")
    private LineAuditInfoVO auditInfo;

    public static InterviewDetailVO convertVO(LineInfoDO lineInfo, LineInterviewDO interviewInfo) {
        InterviewDetailVO result = new InterviewDetailVO();
        result.setInterviewId(interviewInfo.getId());
        result.setLineId(lineInfo.getId());
        result.setPartnerId(lineInfo.getPartnerId());
        result.setInterviewerUserId(interviewInfo.getInterviewerUserId());
        result.setPartnerName(lineInfo.getUsername());
        result.setRegionId(lineInfo.getRegionId());
        result.setInterviewDate(interviewInfo.getInterviewDate());
        result.setStartTime(interviewInfo.getStartTime());
        result.setEndTime(interviewInfo.getEndTime());
        result.setJoinInterviewStatus(interviewInfo.getJoinInterviewStatus());
        result.setActualStartTime(interviewInfo.getActualStartTime());
        result.setActualEndTime(interviewInfo.getActualEndTime());
        result.setRoomId(interviewInfo.getRoomId());
        result.setRoomPassword(interviewInfo.getRoomPassword());
        result.setRoomStatus(interviewInfo.getRoomStatus());
        result.setInterviewStatus(interviewInfo.getInterviewStatus());
        result.setInterviewType(interviewInfo.getInterviewType());
        result.setVideoUrl(JSONObject.parseArray(interviewInfo.getVideoUrl(), String.class));
        return result;
    }
}
