package com.zhongshu.card.server.core.domain.projectAbout;

import com.zhongshu.card.client.type.PassWordDefaultType;
import com.zhongshu.card.client.type.PassWordType;
import com.zhongshu.card.client.type.config.LonginType;
import com.zhongshu.card.client.type.config.RegisterExamineType;
import com.zhongshu.card.client.type.config.RetrievePasswordType;
import com.zhongshu.card.server.core.domain.base.SuperMain;
import com.zhongshu.card.server.core.domain.org.Organization;
import com.zhongshu.card.server.core.domain.org.Role;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 项目相关的 通用设置
 *
 * @author TRX
 * @date 2024/9/24
 */
@Data
@Builder
@Document
@AllArgsConstructor
@NoArgsConstructor
public class ProjectCommonConfig extends SuperMain {

    @Schema(description = "项目信息")
    @DBRef(lazy = true)
    private Organization projectInfo;

    @Schema(description = "项目名称")
    private String projectName;

    //----------------------------业务信息 start-----------------

    //-------------------协议信息 start ------------------
    @Schema(description = "用户协议")
    private String userAgreement = "";

    @Schema(description = "隐私政策")
    private String privacyPolicy = "";

    //-------------------注册控制 start-------------------

    @Schema(description = "是否允许注册")
    private Boolean isAllowRegister = Boolean.FALSE;

    @Schema(description = "注册是否允许选择角色")
    private Boolean isAllowSelectRole = Boolean.FALSE;

    @Schema(description = "注册时可以选择的角色")
    private List<Role> roles = new ArrayList<Role>();

    @Schema(description = "角色集合")
    private List<String> roleIds = new ArrayList<>();

    @Schema(description = "注册是否需要审核")
    private Boolean isExamineRegister = Boolean.TRUE;

    @Schema(description = "审核范围")
    private RegisterExamineType examineType = RegisterExamineType.All;

    @Schema(description = "密码字符组合类型/强度")
    private PassWordType passWordType = PassWordType.Weak;

    //--------------------导入用户密码规则 start---------------
    @Schema(description = "默认密码设置类型")
    private PassWordDefaultType passWordDefaultType = PassWordDefaultType.CardNumberLast6;

    @Schema(description = "这样的默认密码")
    private String defaultPassWord = "123abc";

    //-----------------------密码找回方式 start --------------

    @Schema(description = "找回密码方式")
    private List<RetrievePasswordType> retrievePasswordTypes = new ArrayList<>();

    @Schema(description = "登录方式")
    private List<LonginType> longinTypes = new ArrayList<>();

    //-----------------------人脸照片管理 start---------------

    @Schema(description = "是否允许用户修改人脸数据")
    private Boolean isAllowUpdateFace = Boolean.TRUE;

    @Schema(description = "是否开启人脸审核")
    private Boolean isExamineFace = Boolean.FALSE;

    @Schema(description = "人脸照片相似度(0-100)")
    private Integer similarity = 80;

    @Schema(description = "人脸识别照片上传数量限制")
    private Integer maxFaceNumber = 3;

    @Schema(description = "照片大小限制")
    private BigDecimal maxSize = BigDecimal.valueOf(2);

}
