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

import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
import java.util.Map;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.Data;

/**
 * 工作台分部分项树 创建/更新 Request VO
 */
@Schema(description = "工作台 - 分部分项树创建/更新 Request VO")
@Data
public class WbBoqDivisionSaveReqVO {

    @Schema(description = "节点ID（更新时必填）", example = "1")
    private Long id;

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

    @Schema(description = "父节点ID（分部节点为空）", example = "1")
    private Long parentId;

    @Schema(description = "节点类型：division-分部, boq-清单, quota-定额", requiredMode = Schema.RequiredMode.REQUIRED, example = "division")
    @NotBlank(message = "节点类型不能为空")
    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 = "引用定额基价ID（定额用）", example = "1")
    private Long sourceQuotaItemId;

    @Schema(description = "编码", example = "010101")
    @Size(max = 50, message = "编码长度不能超过50个字符")
    private String code;

    @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "土石方工程")
    @NotBlank(message = "名称不能为空")
    @Size(max = 500, message = "名称长度不能超过500个字符")
    private String name;

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

    @Schema(description = "单位（字典）", example = "m3")
    @Size(max = 20, message = "单位长度不能超过20个字符")
    private String unit;

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

    @Schema(description = "费用代号（只允许英文字符串，代表合价的值）", example = "CLF")
    @Size(max = 50, message = "费用代号长度不能超过50个字符")
    @javax.validation.constraints.Pattern(regexp = "^[a-zA-Z]*$", message = "费用代号只允许英文字母")
    private String costCode;

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

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

    @Schema(description = "定额工程量公式（如 QDL*2，QDL代表清单工程量）", example = "QDL*2")
    @Size(max = 200, message = "公式长度不能超过200个字符")
    private String quotaQtyFormula;

    @Schema(description = "扩展属性（包含基数范围等）")
    private Map<String, Object> attributes;

    @Schema(description = "标签页类型：division/measure/other/unit_summary（创建时指定，子节点自动继承父节点）", example = "measure")
    private String tabType;
}
