package com.njcn.rdms.module.project.controller.admin.project.vo.member;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.util.List;

@Schema(description = "管理后台 - 项目成员批量新增 Request VO")
@Data
public class ProjectMemberBatchCreateReqVO {

    /**
     * 批量上限沿用需求约定的 200，超过走 Bean Validation 直接 400 拦截。
     * 经理角色（project_manager）由 Service 兜底拦截，不在此体现。
     */
    @Schema(description = "待新增的成员列表，长度 [1, 200]", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "请至少选择一名成员")
    @Size(max = 200, message = "单次批量加入成员不能超过 200 人")
    @Valid
    private List<Item> members;

    @Schema(description = "批量新增成员项")
    @Data
    public static class Item {

        @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
        @NotNull(message = "用户编号不能为空")
        private Long userId;

        @Schema(description = "角色编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3100000002001")
        @NotNull(message = "角色编号不能为空")
        private Long roleId;

        @Schema(description = "备注", example = "本次批量加入")
        @Size(max = 500, message = "备注长度不能超过500个字符")
        private String remark;

    }

}
