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.Size;
import lombok.Data;

import java.time.LocalDate;

/**
 * 编辑执行 Request VO（PUT 全字段语义）。
 * <p>
 * 不含 ownerId / assigneeUserIds：换负责人走 /change-owner 独立端点，协办人维护走 /assignees 独立端点。
 * 详见 docs/项目/2026-05-11-执行按钮可见度对齐设计.md §6.3。
 */
@Schema(description = "管理后台 - 执行编辑 Request VO")
@Data
public class ProjectExecutionUpdateReqVO {

    @Schema(description = "执行编号", example = "5001")
    private Long id;

    @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 = "优先级字典 rdms_req_priority 值，0=P0(最高) / 1=P1 / 2=P2 / 3=P3(最低)",
            requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @NotBlank(message = "优先级不能为空")
    @Size(max = 8, message = "优先级长度不能超过8个字符")
    private String priority;

    @Schema(description = "关联项目需求编号。PUT 全字段语义：传 null=解绑，传值=更新关联。传入值必须属于本项目且需求非终态", 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;

}
