package com.qmth.themis.business.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
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 com.qmth.themis.business.enums.GenderEnum;
import com.qmth.themis.business.util.UidUtil;
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_e_student", description = "学生档案")
public class TEStudent extends BaseEntity {

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

    @ApiModelProperty(value = "证件号")
    @TableField(value = "identity")
    private String identity;

    @ApiModelProperty(value = "登陆密码，密文保存")
    @TableField(value = "password")
    private String password;

    @ApiModelProperty(value = "身份证号")
    @TableField(value = "idcard_number")
    private String idcardNumber;

    @ApiModelProperty(value = "手机号")
    @TableField(value = "mobile_number", updateStrategy = FieldStrategy.IGNORED)
    private String mobileNumber;

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

    @ApiModelProperty(value = "性别")
    @TableField(value = "gender")
    private GenderEnum gender;

    @ApiModelProperty(value = "底照保存地址")
    @TableField(value = "base_photo_path")
    private String basePhotoPath;

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

    public TEStudent() {

    }

    public TEStudent(Long orgId, String identity, String name, Long createId) {
        setId(UidUtil.nextId());
        this.orgId = orgId;
        this.identity = identity;
        this.name = name;
        setCreateId(createId);
    }

    public TEStudent(Long orgId, String identity, String name, Long createId, String mobileNumber) {
        setId(UidUtil.nextId());
        this.orgId = orgId;
        this.identity = identity;
        this.name = name;
        this.mobileNumber = mobileNumber;
        setCreateId(createId);
    }

    public Integer getEnable() {
        return enable;
    }

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

    public Long getOrgId() {
        return orgId;
    }

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

    public String getIdentity() {
        return identity;
    }

    public void setIdentity(String identity) {
        this.identity = identity;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getIdcardNumber() {
        return idcardNumber;
    }

    public void setIdcardNumber(String idcardNumber) {
        this.idcardNumber = idcardNumber;
    }

    public String getMobileNumber() {
        return mobileNumber;
    }

    public void setMobileNumber(String mobileNumber) {
        this.mobileNumber = mobileNumber;
    }

    public String getName() {
        return name;
    }

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

    public String getBasePhotoPath() {
        return basePhotoPath;
    }

    public void setBasePhotoPath(String basePhotoPath) {
        this.basePhotoPath = basePhotoPath;
    }

    public GenderEnum getGender() {
        return gender;
    }

    public void setGender(GenderEnum gender) {
        this.gender = gender;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TEStudent teStudent = (TEStudent) o;
        return orgId.equals(teStudent.orgId) && identity.equals(teStudent.identity);
    }

    @Override
    public int hashCode() {
        return Objects.hash(orgId, identity);
    }

    @Override
    public String toString() {
        return "TEStudent{" +
                "orgId=" + orgId +
                ", identity='" + identity + '\'' +
                '}';
    }
}
