package com.trade.admin.enterprise.customer.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.trade.common.core.domain.BizBaseEntity;
import com.trade.common.validate.ValidatorGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDateTime;

/**
 * @description: 客户推荐码
 * @Author: wanglang
 * @Date: 2024/5/29 9:27
 * @Version: 1.0
 */
@TableName("customer_referral_code")
@ApiModel(value = "CustomerReferralCode", description = "推荐码表")
public class CustomerReferralCode extends BizBaseEntity<CustomerReferralCode> {

    private static final long serialVersionUID = 1L;
    /**
     * 用户ID（B端用户）
     */
    @NotNull(message = "用户ID不能为空")
    @ApiModelProperty("用户ID")
    @TableField("user_id")
    private Long userId;
    /**
     * 用户名称（B端用户）
     */
    @ApiModelProperty("用户名称")
    @TableField("user_name")
    @NotEmpty(message = "用户名称不能为空")
    private String userName;
    /**
     * 登录名（B端用户）
     */
    @ApiModelProperty("登录名")
    @TableField("login_name")
    @NotEmpty(message = "登录名不能为空")
    private String loginName;
    /**
     * 角色ID（B端用户）
     */
    @ApiModelProperty("角色ID")
    @TableField("role_id")
    @NotNull(message = "角色ID不能为空", groups = ValidatorGroup.Add.class)
    private Long roleId;
    /**
     * 角色名称（B端用户）
     */
    @ApiModelProperty("角色名称")
    @TableField("role_name")
    @NotEmpty(message = "角色名称不能为空", groups = ValidatorGroup.Add.class)
    private String roleName;
    /**
     * 推荐码
     */
    @NotEmpty(message = "推荐码不能为空")
    @Length(max = 30, message = "推荐码不能超过30个字符")
    @Pattern(regexp = "[a-zA-Z0-9@./|-]{1,30}", message = "推荐码可包含数字、字母、-、@、.、|、／", groups = {
            ValidatorGroup.Add.class, ValidatorGroup.Update.class
    })
    @ApiModelProperty("推荐码")
    @TableField("referral_code")
    private String referralCode;
    /**
     * 推荐URL前缀
     */
    @ApiModelProperty("推荐URL前缀")
    @TableField("referral_url_prefix")
    @NotEmpty(message = "推荐URL前缀不能为空", groups = ValidatorGroup.Add.class)
    private String referralUrlPrefix;
    /**
     * 推荐URL后缀（是一个参数）
     */
    @ApiModelProperty("推荐URL后缀")
    @TableField("referral_url_suffix")
    @NotEmpty(message = "推荐URL后最不能为空", groups = ValidatorGroup.Add.class)
    private String referralUrlSuffix;
    /**
     * 操作时间（B端用户）
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("操作时间")
    @TableField("operator_time")
    private LocalDateTime operatorTime;
    /**
     * 操作人名称（B端用户）
     */
    @ApiModelProperty("操作人名称")
    @TableField("operator_name")
    private String operatorName;
    /**
     * 操作人ID（B端用户）
     */
    @ApiModelProperty("操作人ID")
    @TableField("operator_id")
    private Long operatorId;
    /**
     * 状态：false 0 禁用，true 1 启用
     */
    @ApiModelProperty("状态")
    @TableField("status")
    private boolean status;
    /**
     * 二维码附件的ID
     */
    @ApiModelProperty("二维码附件的ID")
    @TableField("file_id")
    private Long fileId;
    /**
     * 辅助字段：不保存数据库
     */
    private String referralUrl;
    private String createBy;

    public Long getUserId() {
        return userId;
    }

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

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public String getReferralCode() {
        return referralCode;
    }

    public void setReferralCode(String referralCode) {
        this.referralCode = referralCode;
    }

    public String getReferralUrlPrefix() {
        return referralUrlPrefix;
    }

    public void setReferralUrlPrefix(String referralUrlPrefix) {
        this.referralUrlPrefix = referralUrlPrefix;
    }

    public String getReferralUrlSuffix() {
        return referralUrlSuffix;
    }

    public void setReferralUrlSuffix(String referralUrlSuffix) {
        this.referralUrlSuffix = referralUrlSuffix;
    }

    public LocalDateTime getOperatorTime() {
        return operatorTime;
    }

    public void setOperatorTime(LocalDateTime operatorTime) {
        this.operatorTime = operatorTime;
    }

    public String getOperatorName() {
        return operatorName;
    }

    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }

    public Long getOperatorId() {
        return operatorId;
    }

    public void setOperatorId(Long operatorId) {
        this.operatorId = operatorId;
    }

    public boolean isStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public Long getFileId() {
        return fileId;
    }

    public void setFileId(Long fileId) {
        this.fileId = fileId;
    }

    public String getReferralUrl() {
        return referralUrl;
    }

    public void setReferralUrl(String referralUrl) {
        this.referralUrl = referralUrl;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }
}
