package com.qmth.themis.business.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.themis.business.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Objects;

/**
 * @Description: 机构
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/6/25
 */
@ApiModel(value = "t_b_org", description = "机构")
public class TBOrg extends BaseEntity {

    @ApiModelProperty(value = "机构代码，通常用学校简称表示，全局唯一")
    @TableField(value = "code")
    private String code;

    @ApiModelProperty(value = "名称")
    @TableField(value = "name")
    private String name;

    @ApiModelProperty(value = "logo图片url")
    @TableField(value = "logo")
    private String logo;

    @ApiModelProperty(value = "是否启用，0：停用，1：启用")
    @TableField(value = "enable")
    private Integer enable;

    @ApiModelProperty(value = "是否开启模考，0：不开启，1：开启")
    @TableField(value = "enable_simulate")
    private Integer enableSimulate;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "模考试卷id")
    @TableField(value = "simulate_paper_id")
    private Long simulatePaperId;

    @ApiModelProperty(value = "外部访问凭证")
    @TableField(value = "access_key")
    private String accessKey;

    @ApiModelProperty(value = "外部访问密钥")
    @TableField(value = "access_secret")
    private String accessSecret;

    @ApiModelProperty(value = "联系人")
    @TableField(value = "contact_name")
    private String contactName;

    @ApiModelProperty(value = "联系人电话")
    @TableField(value = "contact_phone")
    private String contactPhone;

    @ApiModelProperty(value = "是否允许使用活体，0：不允许，1：允许")
    @TableField(value = "enable_liveness")
    private Integer enableLiveness;

    @ApiModelProperty(value = "是否允许监控转录，0：不允许，1：允许")
    @TableField(value = "enable_monitor_record")
    private Integer enableMonitorRecord;

    public TBOrg() {

    }

    public TBOrg(Long id, String code, String name, String accessKey, String accessSecret) {
        this.code = code;
        this.name = name;
        this.accessKey = accessKey;
        this.accessSecret = accessSecret;
        setId(id);
        this.enable = 1;
        this.enableLiveness = 1;
        this.enableMonitorRecord = 1;
        setCreateId(1L);
        setCreateTime(System.currentTimeMillis());
    }

    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    public String getContactPhone() {
        return contactPhone;
    }

    public void setContactPhone(String contactPhone) {
        this.contactPhone = contactPhone;
    }

    public Integer getEnableLiveness() {
        return enableLiveness;
    }

    public void setEnableLiveness(Integer enableLiveness) {
        this.enableLiveness = enableLiveness;
    }

    public Integer getEnableMonitorRecord() {
        return enableMonitorRecord;
    }

    public void setEnableMonitorRecord(Integer enableMonitorRecord) {
        this.enableMonitorRecord = enableMonitorRecord;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public Integer getEnable() {
        return enable;
    }

    public void setEnable(Integer enable) {
        this.enable = enable;
    }

    public Integer getEnableSimulate() {
        return enableSimulate;
    }

    public void setEnableSimulate(Integer enableSimulate) {
        this.enableSimulate = enableSimulate;
    }

    public Long getSimulatePaperId() {
        return simulatePaperId;
    }

    public void setSimulatePaperId(Long simulatePaperId) {
        this.simulatePaperId = simulatePaperId;
    }

    public String getAccessKey() {
        return accessKey;
    }

    public void setAccessKey(String accessKey) {
        this.accessKey = accessKey;
    }

    public String getAccessSecret() {
        return accessSecret;
    }

    public void setAccessSecret(String accessSecret) {
        this.accessSecret = accessSecret;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TBOrg tbOrg = (TBOrg) o;
        return code.equals(tbOrg.code) && name.equals(tbOrg.name) && logo.equals(tbOrg.logo) && enable.equals(tbOrg.enable) && enableSimulate.equals(tbOrg.enableSimulate) && simulatePaperId.equals(tbOrg.simulatePaperId) && accessKey.equals(tbOrg.accessKey) && accessSecret.equals(tbOrg.accessSecret) && contactName.equals(tbOrg.contactName) && contactPhone.equals(tbOrg.contactPhone) && enableLiveness.equals(tbOrg.enableLiveness) && enableMonitorRecord.equals(tbOrg.enableMonitorRecord);
    }

    @Override
    public int hashCode() {
        return Objects.hash(code, name, logo, enable, enableSimulate, simulatePaperId, accessKey, accessSecret, contactName, contactPhone, enableLiveness, enableMonitorRecord);
    }
}
