package com.xunhong.erp.turbo.api.user.dto.cmd;

import com.alibaba.cola.dto.Command;
import com.xunhong.erp.turbo.base.annotation.Decrypt;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * @author shenyifei
 */
@Data
@Schema(title = "员工信息创建")
@EqualsAndHashCode(callSuper = true)
public class EmployeeCreateCmd extends Command {

	@Schema(title = "姓名", requiredMode = Schema.RequiredMode.REQUIRED)
	@NotBlank(message = "姓名不能为空")
	private String name;

	@Schema(title = "工号", requiredMode = Schema.RequiredMode.REQUIRED)
	@NotBlank(message = "工号不能为空")
	private String number;

	@Schema(title = "性别", requiredMode = Schema.RequiredMode.REQUIRED)
	@NotNull(message = "请选择性别")
	private Integer gender;

	@Schema(title = "手机号", requiredMode = Schema.RequiredMode.REQUIRED)
	@NotBlank(message = "手机号不能为空")
	@Pattern(regexp = "^(1[3-9])\\d{9}$", message = "手机号格式错误")
	private String phone;

	@Schema(title = "备注")
	@Size(max = 200, message = "最多200个字符")
	private String remark;

	@Schema(title = "状态")
	@NotNull(message = "请选择状态")
	private Boolean status;

	@Size(min = 4, max = 20, message = "至少4个字符串，至多20个字符串")
	@NotBlank(message = "不能为空")
	@Schema(title = "登录账号", example = "18367831980")
	private String username;

	@Decrypt
	@NotBlank
	@Size(min = 8, max = 20)
	@Pattern(regexp = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$", message = "密码必须至少8个字符，包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符")
	@Schema(title = "登录密码", example = "18367831980")
	private String password;

	@Schema(title = "角色ID", requiredMode = Schema.RequiredMode.REQUIRED)
	private List<Long> roleId;

	@Schema(title = "用户ID", type = "string", hidden = true)
	private Long userId;
}
