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

import com.njcn.rdms.module.project.dal.dataobject.attachment.AttachmentItem;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 管理后台 - 项目需求 Response VO
 */
@Schema(description = "管理后台 - 项目需求 Response VO")
@Data
public class ProjectRequirementRespVO {

    @Schema(description = "需求ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    private Long id;

    @Schema(description = "父需求ID，0 表示顶级需求", example = "0")
    private Long parentId;

    @Schema(description = "所属项目ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    private Long projectId;

    @Schema(description = "所属模块ID", example = "1024")
    private Long moduleId;

    @Schema(description = "是否需要评审，0不需要，1需要", example = "0")
    private Integer reviewRequired;

    @Schema(description = "需求标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "支持需求模块化管理")
    private String title;

    @Schema(description = "需求描述，支持富文本", example = "<p>详细描述需求内容</p>")
    private String description;

    @Schema(description = "需求分类字典值", example = "function")
    private String category;

    @Schema(description = "需求分类名称", example = "功能需求")
    private String categoryName;

    @Schema(description = "需求来源类型", example = "manual")
    private String sourceType;

    @Schema(description = "来源业务编号", example = "CRM-20260615-001")
    private String sourceBizCode;

    @Schema(description = "优先级", example = "1")
    private Integer priority;

    @Schema(description = "优先级名称", example = "中")
    private String priorityName;

    @Schema(description = "当前状态编码", example = "implementing")
    private String statusCode;

    @Schema(description = "当前状态名称", example = "实施中")
    private String statusName;

    @Schema(description = "最近一次状态动作原因", example = "需求全部结束")
    private String lastStatusReason;

    @Schema(description = "提出人用户ID", example = "1024")
    private Long proposerId;

    @Schema(description = "提出人姓名", example = "张三")
    private String proposerNickname;

    @Schema(description = "预期完成时间", example = "2026-05-31")
    private LocalDate expectedTime;

    @Schema(description = "当前处理人用户ID", example = "1024")
    private Long currentHandlerUserId;

    @Schema(description = "当前处理人姓名", example = "李四")
    private String currentHandlerUserNickname;

    @Schema(description = "排序值", example = "0")
    private Integer sort;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime createTime;

    @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime updateTime;

    @Schema(description = "附件列表")
    private List<AttachmentItem> attachments;

    @Schema(description = "子需求列表，树形结构")
    private List<ProjectRequirementRespVO> children;

    @Schema(description = "是否为终态", example = "false")
    private Boolean terminal;

    @Schema(description = "需求进度。TD-016：读时聚合计算已下线（前端当前不展示需求进度，进度仅项目/执行/任务展示），"
            + "字段保留占位、当前恒为 null；未来需要展示需求进度时再恢复服务端聚合计算。",
            example = "0.65")
    private BigDecimal progressRate;

}
