package com.qmth.themis.business.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.themis.business.enums.InvigilateMonitorStatusEnum;
import com.qmth.themis.business.util.UidUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Objects;

/**
 * @Description: 监考员设置
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/7/9
 */
@ApiModel(value = "t_b_exam_invigilate_user", description = "监考员设置")
public class TBExamInvigilateUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "主键")
    @TableId(value = "id")
    private Long id;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "考试批次ID")
    @TableField(value = "exam_id")
    private Long examId;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "机构ID")
    @TableField(value = "org_id")
    private Long orgId;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "用户ID")
    @TableField(value = "user_id", updateStrategy = FieldStrategy.IGNORED)
    private Long userId;

    @ApiModelProperty(value = "考场代码")
    @TableField(value = "room_code")
    private String roomCode;

    @ApiModelProperty(value = "考场名称")
    @TableField(value = "room_name")
    private String roomName;

    @ApiModelProperty(value = "监考状态，NOT_START：未开始，START：监考中，FINISHED：已结束")
    @TableField(value = "monitor_status")
    private InvigilateMonitorStatusEnum monitorStatus;

    public TBExamInvigilateUser() {

    }

    public TBExamInvigilateUser(Long examId, Long orgId, String roomCode, String roomName) {
        this.id = UidUtil.nextId();
        this.examId = examId;
        this.orgId = orgId;
        this.roomCode = roomCode;
        this.roomName = roomName;
    }

    public TBExamInvigilateUser(Long examId, Long orgId, Long userId, String roomCode, String roomName) {
        this.id = UidUtil.nextId();
        this.examId = examId;
        this.orgId = orgId;
        this.userId = userId;
        this.roomCode = roomCode;
        this.roomName = roomName;
    }

    public Long getExamId() {
        return examId;
    }

    public void setExamId(Long examId) {
        this.examId = examId;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getOrgId() {
        return orgId;
    }

    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getRoomCode() {
        return roomCode;
    }

    public void setRoomCode(String roomCode) {
        this.roomCode = roomCode;
    }

    public String getRoomName() {
        return roomName;
    }

    public void setRoomName(String roomName) {
        this.roomName = roomName;
    }

    public InvigilateMonitorStatusEnum getMonitorStatus() {
        return monitorStatus;
    }

    public void setMonitorStatus(InvigilateMonitorStatusEnum monitorStatus) {
        this.monitorStatus = monitorStatus;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TBExamInvigilateUser that = (TBExamInvigilateUser) o;
        return Objects.equals(examId, that.examId) &&
                Objects.equals(orgId, that.orgId) &&
                Objects.equals(userId, that.userId) &&
                Objects.equals(roomCode, that.roomCode) &&
                Objects.equals(roomName, that.roomName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(examId, orgId, userId, roomCode, roomName);
    }
}
