package com.qmth.sop.business.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.sop.common.base.BaseEntity;
import com.qmth.sop.common.contant.SystemConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * <p>
 * 短信验证码记录表
 * </p>
 *
 * @author wangliang
 * @since 2023-08-01
 */
@ApiModel(value = "BasicVerifyCode对象", description = "短信验证码记录表")
public class BasicVerifyCode extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

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

    @ApiModelProperty(value = "用户ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    @ApiModelProperty(value = "手机号")
    private String mobileNumber;

    @ApiModelProperty(value = "到期时间")
    private Long expireTime;

    @ApiModelProperty(value = "单位（分）")
    private Integer validPeriod;

    @ApiModelProperty(value = "4位数字")
    private String verifyCode;

    public BasicVerifyCode() {

    }

    public BasicVerifyCode(Long userId, Long orgId, String mobileNumber, Long expireTime, Integer validPeriod, String verifyCode) {
        setId(SystemConstant.getDbUuid());
        this.userId = userId;
        this.orgId = orgId;
        this.mobileNumber = mobileNumber;
        this.expireTime = expireTime;
        this.validPeriod = validPeriod;
        this.verifyCode = verifyCode;
        setCreateId(userId);
        setCreateTime(System.currentTimeMillis());
    }

    public void updateVerifyCodeInfo(Long userId, Long orgId, Long expireTime, Integer validPeriod, String verifyCode) {
        this.expireTime = expireTime;
        this.orgId = orgId;
        this.validPeriod = validPeriod;
        this.verifyCode = verifyCode;
        setUpdateId(userId);
        setUpdateTime(System.currentTimeMillis());
    }

    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 getMobileNumber() {
        return mobileNumber;
    }

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

    public Long getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(Long expireTime) {
        this.expireTime = expireTime;
    }

    public Integer getValidPeriod() {
        return validPeriod;
    }

    public void setValidPeriod(Integer validPeriod) {
        this.validPeriod = validPeriod;
    }

    public String getVerifyCode() {
        return verifyCode;
    }

    public void setVerifyCode(String verifyCode) {
        this.verifyCode = verifyCode;
    }
}
