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.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

@Schema(description = "管理后台 - 工作台「我的工时周聚合」Response VO")
@Data
public class MyWorklogWeekRespVO {

    @Schema(description = "所选周周一", requiredMode = Schema.RequiredMode.REQUIRED, example = "2026-06-08")
    private LocalDate weekStart;
    @Schema(description = "周一~周五逐日工时(固定 5 元素,均摊推算值,保留 2 位小数)", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<BigDecimal> dailyHours;
    @Schema(description = "本周工时按归属分布(hours 降序,personal/other 排在项目后)", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<DistributionItemVO> distribution;

    @Schema(description = "工时分布项")
    @Data
    public static class DistributionItemVO {
        @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=个人事项 / other=无法归类", requiredMode = Schema.RequiredMode.REQUIRED, example = "project")
        private String kind;
        @Schema(description = "本周工时合计(保留 2 位小数)", requiredMode = Schema.RequiredMode.REQUIRED, example = "12.5")
        private BigDecimal hours;
    }

}
