package com.gxwebsoft.common.system.entity;

import cn.hutool.core.util.DesensitizedUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Date;

/**
 * 商户账号
 *
 * @author 科技小王子
 * @since 2024-04-19 12:02:24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(name = "MerchantAccount对象", description = "商户账号")
@TableName("sys_merchant_account")
public class MerchantAccount implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @Schema(description = "商户手机号")
    private String phone;

    @Schema(description = "账号密码")
    @TableField(exist = false)
    private String password;

    @Schema(description = "真实姓名")
    private String realName;

    @Schema(description = "商户ID")
    private Long merchantId;

    @Schema(description = "角色ID")
    private Integer roleId;

    @Schema(description = "角色名称")
    private String roleName;

    @Schema(description = "用户ID")
    private Integer userId;

    @Schema(description = "备注")
    private String comments;

    @Schema(description = "状态")
    private Integer status;

    @Schema(description = "排序号")
    private Integer sortNumber;

    @Schema(description = "租户id")
    private Integer tenantId;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Schema(description = "商户名称")
    @TableField(exist = false)
    private String merchantName;

    @Schema(description = "是否需要审核")
    @TableField(exist = false)
    private Boolean goodsReview;

    @Schema(description = "手机号(脱敏)")
    @TableField(exist = false)
    private String mobile;

    @Schema(description = "是否管理员")
    @TableField(exist = false)
    private Boolean isAdmin;

    public String getMobile(){
      return DesensitizedUtil.mobilePhone(this.phone);
    }

}
