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

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.util.List;

@Schema(description = "管理后台 - 工作台「团队负载」Response VO")
@Data
public class TeamLoadRespVO {

    @Schema(description = "团队成员负载列表;members[0] 恒为当前用户,其余按压力降序", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<MemberVO> members;

    @Schema(description = "单个成员的负载")
    @Data
    public static class MemberVO {
        @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1001")
        @JsonSerialize(using = ToStringSerializer.class)
        private Long userId;
        @Schema(description = "用户昵称", example = "张三")
        private String userNickname;
        @Schema(description = "未完成任务按归属分布(项目任务行 + 个人事项行)", requiredMode = Schema.RequiredMode.REQUIRED)
        private List<LoadItemVO> items;
        @Schema(description = "临期数:今天 <= 计划结束 <= 今天+3,未完成(任务+个人事项)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
        private Integer dueSoonCount;
        @Schema(description = "逾期数:计划结束 < 今天,未完成(任务+个人事项)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
        private Integer overdueCount;
    }

    @Schema(description = "负载分布项")
    @Data
    public static class LoadItemVO {
        @Schema(description = "项目编号;kind != project 时为 null", example = "1923456789012345678")
        @JsonSerialize(using = ToStringSerializer.class)
        private Long projectId;
        @Schema(description = "项目名称;kind != project 时为 null", example = "收银台 V3")
        private String projectName;
        @Schema(description = "归属类型:project=项目任务 / personal=个人事项", requiredMode = Schema.RequiredMode.REQUIRED, example = "project")
        private String kind;
        @Schema(description = "未完成数", requiredMode = Schema.RequiredMode.REQUIRED, example = "4")
        private Integer count;
    }

}
