package com.njcn.rdms.module.project.controller.admin.project.task.vo.mytask;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.njcn.rdms.module.project.controller.admin.project.task.vo.ProjectTaskLifecycleActionRespVO;
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;

@Schema(description = "管理后台 - 工作台「我的任务」Response VO")
@Data
public class MyTaskRespVO {

    @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1934567890123456789")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    @Schema(description = "任务标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "支付回调接口联调遗留问题处理")
    private String taskTitle;
    @Schema(description = "所属项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1923456789012345678")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long projectId;
    @Schema(description = "所属项目名称", example = "收银台 V3")
    private String projectName;
    @Schema(description = "所属执行编号(可空)", example = "1928888888888888888")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long executionId;
    @Schema(description = "所属执行名称(可空)", example = "后端联调")
    private String executionName;
    @Schema(description = "任务状态编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "active")
    private String statusCode;
    @Schema(description = "任务状态名称", example = "进行中")
    private String statusName;
    @Schema(description = "优先级(字典 rdms_req_priority 原样返回)", example = "1")
    private String priority;
    @Schema(description = "计划结束日期(可空)", example = "2026-06-15")
    private LocalDate plannedEndDate;
    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime createTime;
    @Schema(description = "我的身份:owner=负责人 / collaborator=协办人;双重身份返回 owner", requiredMode = Schema.RequiredMode.REQUIRED, example = "owner")
    private String myRole;
    @Schema(description = "父任务编号(可空)", example = "1934567890123456788")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentTaskId;
    @Schema(description = "任务进度，范围 0-100", requiredMode = Schema.RequiredMode.REQUIRED, example = "60")
    private BigDecimal progressRate;
    @Schema(description = "是否终态", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
    private Boolean terminal;
    @Schema(description = "当前状态是否允许编辑", example = "true")
    private Boolean allowEdit;
    @Schema(description = "当前登录用户在当前状态下可执行的任务生命周期动作；无动作返回空数组")
    private List<ProjectTaskLifecycleActionRespVO> availableActions;

}
