package com.cool.store.entity;

import com.cool.store.enums.InterviewStatusEnum;
import com.cool.store.utils.UUIDUtils;
import lombok.Data;

import java.util.Date;
import javax.persistence.*;

@Data
@Table(name = "xfsg_line_interview")
public class LineInterviewDO {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * line_info.id
     */
    @Column(name = "line_id")
    private Long lineId;

    /**
     * partner_user_info.partner_id
     */
    @Column(name = "partner_id")
    private String partnerId;

    /**
     * 区域ID
     */
    @Column(name = "region_id")
    private Long regionId;

    /**
     * 面试日期
     */
    @Column(name = "interview_date")
    private Date interviewDate;

    /**
     * 面试开始时间
     */
    @Column(name = "start_time")
    private Date startTime;

    /**
     * 面试结束时间
     */
    @Column(name = "end_time")
    private Date endTime;

    /**
     * 0未参加，1加盟商先进入 2面试官先进入 3双方都参加
     */
    @Column(name = "join_interview_status")
    private Integer joinInterviewStatus;

    /**
     * 实际开始时间
     */
    @Column(name = "actual_start_time")
    private Date actualStartTime;

    /**
     * 实际结束时间
     */
    @Column(name = "actual_end_time")
    private Date actualEndTime;

    /**
     * 房间号
     */
    @Column(name = "room_id")
    private String roomId;

    /**
     * 房间密码
     */
    @Column(name = "room_password")
    private String roomPassword;

    /**
     * 面试官
     */
    @Column(name = "interviewer_user_id")
    private String interviewerUserId;

    /**
     * 房间状态:0待开放;1已开放; 2已关闭
     */
    @Column(name = "room_status")
    private Integer roomStatus;

    /**
     * 面试状态 0待面试 1已通过 2未通过
     */
    @Column(name = "interview_status")
    private Integer interviewStatus;

    /**
     * 面试类型:0面谈，1一审，2二审
     */
    @Column(name = "interview_type")
    private Integer interviewType;

    /**
     * 视频链接
     */
    @Column(name = "video_url")
    private String videoUrl;

    /**
     * line_audit_info.id
     */
    @Column(name = "audit_id")
    private Long auditId;

    /**
     * line_calendars_event.id
     */
    @Column(name = "calendars_event_id")
    private Long calendarsEventId;

    /**
     * 删除标识
     */
    private Boolean deleted;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 更新时间
     */
    @Column(name = "update_time")
    private Date updateTime;

    public static LineInterviewDO convertDO(LineInfoDO lineInfo, Date startTime, Date endTime, String roomId, String interviewer, Integer interviewType, Long calendarsEventId){
        LineInterviewDO addInterview = new LineInterviewDO();
        addInterview.setLineId(lineInfo.getId());
        addInterview.setPartnerId(lineInfo.getPartnerId());
        addInterview.setRegionId(lineInfo.getRegionId());
        addInterview.setInterviewDate(startTime);
        addInterview.setStartTime(startTime);
        addInterview.setEndTime(endTime);
        addInterview.setRoomId(roomId);
        addInterview.setInterviewerUserId(interviewer);
        addInterview.setInterviewType(interviewType);
        addInterview.setCalendarsEventId(calendarsEventId);
        addInterview.setInterviewStatus(InterviewStatusEnum.WAIT_INTERVIEW.getCode());
        return addInterview;
    }

}