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

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

import java.time.LocalDate;
import java.util.List;

/**
 * 创建执行 Request VO。
 * <p>
 * 含 ownerId（必填）+ assigneeUserIds（创建时同步装配协办人）。
 * 后续编辑主数据走 PUT + {@link ProjectExecutionUpdateReqVO}（不含 ownerId / 协办人字段，避免越权裂缝）。
 */
@Schema(description = "管理后台 - 执行创建 Request VO")
@Data
public class ProjectExecutionCreateReqVO {

    @Schema(description = "执行名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "后端接口联调")
    @NotBlank(message = "执行名称不能为空")
    @Size(max = 200, message = "执行名称长度不能超过200个字符")
    private String executionName;

    @Schema(description = "执行类型，取值来自字典 rdms_project_execution_type", requiredMode = Schema.RequiredMode.REQUIRED, example = "feature")
    @NotBlank(message = "执行类型不能为空")
    @Size(max = 32, message = "执行类型长度不能超过32个字符")
    private String executionType;

    @Schema(description = "执行负责人用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3001")
    @NotNull(message = "执行负责人不能为空")
    private Long ownerId;

    @Schema(description = "关联项目需求编号，第一阶段只接受空值", example = "9001")
    private Long projectRequirementId;

    @Schema(description = "计划开始日期")
    private LocalDate plannedStartDate;

    @Schema(description = "计划结束日期")
    private LocalDate plannedEndDate;

    @Schema(description = "执行说明（接受 HTML 富文本，图片走 URL 引用；后端经全局 XSS Safelist 自动净化）",
            example = "接口联调与问题跟踪")
    @Size(max = 200000, message = "执行说明长度不能超过200000个字符")
    private String executionDesc;

    @Schema(description = "创建执行时同步写入的协办人用户编号列表", example = "[3002,3003]")
    private List<Long> assigneeUserIds;

}
