package com.xunhong.erp.turbo.user.infrastructure.entity;

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.xunhong.erp.turbo.api.user.dto.enums.UserStateEnum;
import com.xunhong.erp.turbo.datasource.domain.entity.BaseDO;
import com.xunhong.erp.turbo.datasource.handler.AesEncryptTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * @author shenyifei
 */
@Data
@TableName(value = "user", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
public class UserDO extends BaseDO<UserDO> {

	/**
	 * 用户id
	 */
	@TableId(value = "user_id", type = IdType.ASSIGN_ID)
	private Long userId;

	/**
	 * 昵称
	 */
	@TableField(value = "nickname")
	private String nickname;

	/**
	 * 头像
	 */
	@TableField(value = "avatar")
	private String avatar;

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

	/**
	 * 手机号
	 */
	@TableField(value = "phone", typeHandler = AesEncryptTypeHandler.class)
	private String phone;

	/**
	 * 生日
	 */
	@TableField(value = "birthday")
	private String birthday;

	/**
	 * 性别 1.男 2.女
	 */
	@TableField(value = "gender")
	private Integer gender;

	/**
	 * 状态 1.启用 2.禁用
	 */
	@TableField(value = "state")
	private UserStateEnum state;

	/**
	 * 绑定手机号码时间
	 */
	@TableField(value = "bind_phone_at")
	private LocalDateTime bindPhoneAt;

	/**
	 * 最后一次登录时间
	 */
	@TableField(value = "last_login_at")
	private LocalDateTime lastLoginAt;

	/**
	 * 微信公众号openid
	 */
	@TableField(value = "mp_openid")
	private String mpOpenid;

	/**
	 * 微信小程序openid
	 */
	@TableField(value = "ma_openid")
	private String maOpenid;

	/**
	 * 开放平台unionid
	 */
	@TableField(value = "unionid")
	private String unionid;

	/**
	 * 备注
	 */
	@TableField(value = "remark")
	private String remark;

	/**
	 * 是否是管理员 1.是 0.否
	 */
	@TableField(value = "is_admin")
	private Boolean isAdmin;

	/**
	 * 是否是小区合伙人 1.是 0.否
	 */
	@TableField(value = "is_partner")
	private Boolean isPartner;
}
