package com.snack.server.module.admin.dto.req;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serializable;

/**
 * 创建/更新管理员请求
 */
@Data
@Schema(description = "创建/更新管理员请求")
public class AdminSaveReq implements Serializable {

    /** 主键（更新时必填，创建时为空） */
    @Schema(description = "管理员 ID（更新时必填）")
    private Long id;

    @NotBlank(message = "用户名不能为空")
    @Size(min = 3, max = 30, message = "用户名长度需在 3-30 之间")
    @Schema(description = "登录用户名", example = "operator02")
    private String username;

    /** 创建时必填；更新时为空表示不修改密码 */
    @Schema(description = "密码（创建必填，更新时为空表示不修改）")
    private String password;

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

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

    @Email(message = "邮箱格式不正确")
    @Schema(description = "邮箱")
    private String email;

    @Pattern(regexp = "^$|^1[3-9]\\d{9}$", message = "手机号格式不正确")
    @Schema(description = "手机号")
    private String phone;

    @NotBlank(message = "角色不能为空")
    @Schema(description = "角色：super_admin / admin / operator", example = "admin")
    private String role;

    @Schema(description = "状态：0-禁用 1-启用", example = "1")
    private Integer status = 1;
}
