package com.cf.imes.module.system.controller.admin.user.vo.user;

import com.cf.imes.framework.common.validation.Mobile;
import com.cf.imes.module.system.validation.common.CommonStatus;
import com.cf.imes.module.system.validation.user.SexValid;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.util.Set;

@Schema(description = "管理后台 - 用户创建/修改 Request VO")
@Data
public class UserSaveReqVO {

    @Schema(description = "用户编号", example = "1024")
    private Long id;

    @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
    @Size(max = 30, message = "用户昵称长度不能超过30个字符")
    @NotBlank(message = "用户姓名不能为空")
    private String nickname;

    @Schema(description = "备注", example = "我是一个用户")
    @Size(max = 255, message = "备注长度不能超过255个字符")
    private String remark;

    @Schema(description = "部门ID", example = "我是一个用户")
    @NotNull(message = "部门编号不能为空")
    private Long deptId;

    @Schema(description = "岗位编号数组", example = "1")
    @Size(max = 20, message = "岗位数量不能超过 20 个")
    private Set<Long> postIds;

    @Schema(description = "用户邮箱", example = "chenfeng@cf.com")
    @Email(message = "邮箱格式不正确")
    @Size(max = 50, message = "邮箱长度不能超过 50 个字符")
    private String email;

    @Schema(description = "手机号码", example = "15601691300")
    @Mobile
    @NotBlank(message = "手机号码不能为空")
    private String mobile;

    @Schema(description = "用户性别，参见 SexEnum 枚举类", example = "1")
    @SexValid
    private Integer sex;

    @Schema(description = "用户头像", example = "https://www.cf.com/xxx.png")
    @Size(max = 512, message = "用户头像存储地址不能超过 512 个字符")
    private String avatar;

    // ========== 仅【创建】时，需要传递的字段 ==========

    @Schema(description = "帐号状态（0正常 1停用）")
    @NotNull(message = "账号状态不能空")
    @CommonStatus
    private Integer status;

    private Long organId;

}
