package com.zhongshu.card.client.model.org;

import com.zhongshu.card.client.type.Sex;
import com.zhongshu.card.client.type.UserState;
import com.zhongshu.card.client.type.UserType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.internal.build.AllowPrintStacktrace;

/**
 * 注册用户
 *
 * @author TRX
 * @date 2024/6/17
 */
@Data
@AllowPrintStacktrace
@NoArgsConstructor
public class RegisterUserAccountParam {

    @Schema(description = "登录名", hidden = true)
    private String loginName;

    public String getLoginName() {
        if (StringUtils.isNotEmpty(loginName)) {
            return loginName;
        }
        return phone;
    }

    @Schema(description = "密码", hidden = true)
    private String password;

    public String getPassword() {
        return password;
    }

    @Schema(description = "头像")
    private String profilePic;

    @Schema(description = "用户手机号")
    @NotEmpty(message = "phone不能为空")
    private String phone;

    @Schema(description = "昵称")
    private String name;

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

    @Schema(description = "证件号码")
    private String cardNumber;

    @Schema(description = "性别")
    private Sex sex;

    @Schema(description = "用户类型", hidden = true)
    private UserType userType = UserType.Consumer;

    @Schema(description = "用户状态")
    private UserState state;

}
