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

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

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

@Schema(description = "管理后台 - 我负责的项目 Response VO")
@Data
public class MyProjectOwnedRespVO {

    @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2001")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    @Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "商城 V2 升级")
    private String name;
    @Schema(description = "项目编码", example = "MALL-V2")
    private String code;
    @Schema(description = "项目整体进度百分比 0-100", requiredMode = Schema.RequiredMode.REQUIRED, example = "70")
    private Integer progress;
    @Schema(description = "当前用户在该项目中的角色名（恒含负责人语义）", example = "项目负责人")
    private String myRole;
    @Schema(description = "项目计划结束日期 YYYY-MM-DD；未设为 null")
    private LocalDate plannedEndDate;
    @Schema(description = "项目下进行中执行数", requiredMode = Schema.RequiredMode.REQUIRED, example = "6")
    private Integer executionCount;
    @Schema(description = "项目下进行中任务数", requiredMode = Schema.RequiredMode.REQUIRED, example = "24")
    private Integer taskCount;
    @Schema(description = "项目当前有效成员数", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
    private Integer memberCount;
    @Schema(description = "项目下逾期任务数", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    private Integer overdueCount;
    @Schema(description = "成员负载原始数据；无成员为 []", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<MemberLoadVO> members;

    @Schema(description = "成员负载原始数据")
    @Data
    public static class MemberLoadVO {
        @Schema(description = "成员用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "101")
        @JsonSerialize(using = ToStringSerializer.class)
        private Long userId;
        @Schema(description = "成员姓名/昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
        private String userName;
        @Schema(description = "该成员在本项目下的进行中任务数", requiredMode = Schema.RequiredMode.REQUIRED, example = "6")
        private Integer activeTaskCount;
    }

}
