package com.yhy.module.core.controller.admin.workbench.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import lombok.Data;

/**
 * 工作台分部分项树 Response VO
 */
@Schema(description = "工作台 - 分部分项树 Response VO")
@Data
public class WbBoqDivisionRespVO {

    @Schema(description = "节点ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long id;

    @Schema(description = "编制模式树的单位工程节点ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long compileTreeId;

    @Schema(description = "父节点ID", example = "1")
    private Long parentId;

    @Schema(description = "节点类型：division-分部, boq-清单, quota-定额", requiredMode = Schema.RequiredMode.REQUIRED, example = "division")
    private String nodeType;

    @Schema(description = "来源类型：catalog-从标准库引用, manual-手工录入", example = "manual")
    private String sourceType;

    @Schema(description = "引用清单目录ID", example = "1")
    private Long sourceBoqCatalogId;

    @Schema(description = "引用清单项树ID", example = "1")
    private Long sourceBoqItemTreeId;

    @Schema(description = "清单说明（关联查询，来自后台清单子目）", example = "<p>适用于建筑场地的平整工程</p>")
    private String boqDescription;

    @Schema(description = "清单章节名称（关联查询）", example = "土石方工程")
    private String boqChapterName;

    @Schema(description = "清单专业名称（关联查询）", example = "广东建筑工程清单")
    private String boqProfessionName;

    @Schema(description = "引用定额基价ID", example = "1")
    private Long sourceQuotaItemId;

    @Schema(description = "定额所属子目录ID（用于取费章节过滤）", example = "1")
    private Long sourceCatalogItemId;

    @Schema(description = "定额所属子目录路径（用于取费章节过滤，包含所有祖先节点ID）")
    private String[] sourceCatalogPath;

    @Schema(description = "编码", example = "010101")
    private String code;

    @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "土石方工程")
    private String name;

    @Schema(description = "项目特征", example = "1.土壤类别：一类土")
    private String feature;

    @Schema(description = "单位（字典）", example = "m3")
    private String unit;

    @Schema(description = "工程量", example = "100.00")
    private BigDecimal qty;

    @Schema(description = "费用代号（只允许英文字符串，代表合价的值）", example = "CLF")
    private String costCode;

    @Schema(description = "费率", example = "3.5")
    private BigDecimal rate;

    @Schema(description = "备注")
    private String remark;

    @Schema(description = "定额工程量公式（如 QDL*2，QDL代表清单工程量）", example = "QDL*2")
    private String quotaQtyFormula;

    @Schema(description = "单价（虚拟字段，内存计算）", example = "25.50")
    private BigDecimal unitPrice;

    @Schema(description = "合价（虚拟字段，内存计算）", example = "2550.00")
    private BigDecimal amount;

    @Schema(description = "行号", example = "1")
    private String lineNo;

    @Schema(description = "排序号", example = "1")
    private Integer sortOrder;

    @Schema(description = "层级路径")
    private String[] path;

    @Schema(description = "扩展属性")
    private Map<String, Object> attributes;

    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    @Schema(description = "关联同步库ID（非空表示已同步）")
    private Long syncLibraryId;

    @Schema(description = "是否为同步来源节点")
    private Boolean isSyncSource;

    @Schema(description = "子节点列表")
    private List<WbBoqDivisionRespVO> children;
}
