package cn.iocoder.lyzsys.module.tjt.controller.admin.planning.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;

@Schema(description = "管理后台 - 合约规划新增/修改 Request VO")
@Data
public class ProjectPlanningSaveReqVO {

    @Schema(description = "合约规划 ID", example = "1")
    private Long id;

    @Schema(description = "项目 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @NotNull(message = "项目 ID 不能为空")
    private Long projectId;

    @Schema(description = "排序", example = "0")
    private Integer sortNo;

    @Schema(description = "归属类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "专业所")
    @NotBlank(message = "归属类型不能为空")
    @Size(max = 20, message = "归属类型长度不能超过 20 个字符")
    private String ownershipType;

    @Schema(description = "产值计算方式，页面 2 维护", example = "指导价法")
    @Size(max = 30, message = "产值计算方式长度不能超过 30 个字符")
    private String calculationMethod;

    @Schema(description = "项目任务包", requiredMode = Schema.RequiredMode.REQUIRED, example = "建筑设计")
    @NotBlank(message = "项目任务包不能为空")
    @Size(max = 255, message = "项目任务包长度不能超过 255 个字符")
    private String planningContent;

    @Schema(description = "分项合同产值，系统根据合同产值数量和合同产值单价自动计算", example = "500000")
    private BigDecimal planningAmount;

    @Schema(description = "合同产值数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @NotNull(message = "合同产值数量不能为空")
    @DecimalMin(value = "0.0000", message = "contractValueQuantity must be >= 0")
    private BigDecimal contractValueQuantity;

    @Schema(description = "合同产值单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "500000")
    @NotNull(message = "合同产值单价不能为空")
    @DecimalMin(value = "0.0000", message = "contractValueUnitPrice must be >= 0")
    private BigDecimal contractValueUnitPrice;

    @Schema(description = "管理费率", requiredMode = Schema.RequiredMode.REQUIRED, example = "0.0500")
    @NotNull(message = "管理费率不能为空")
    @DecimalMin(value = "0.0000", message = "managementFeeRate must be >= 0")
    @DecimalMax(value = "1.0000", message = "managementFeeRate must be <= 1")
    private BigDecimal managementFeeRate;

    @Schema(description = "增值税率", requiredMode = Schema.RequiredMode.REQUIRED, example = "0.0600")
    @NotNull(message = "增值税率不能为空")
    @DecimalMin(value = "0.0000", message = "vatRate must be >= 0")
    @DecimalMax(value = "1.0000", message = "vatRate must be <= 1")
    private BigDecimal vatRate;

    @Schema(description = "意向实施团队", example = "建筑一所")
    @Size(max = 100, message = "意向实施团队长度不能超过 100 个字符")
    private String implementationTeam;

    @Schema(description = "开始年度", example = "2026")
    private Integer planningStartYear;

    @Schema(description = "面积", example = "30000")
    private BigDecimal planningArea;

    @Schema(description = "设计阶段", example = "方案设计")
    @Size(max = 50, message = "设计阶段长度不能超过 50 个字符")
    private String designStage;

    @Schema(description = "本次设计阶段比例", example = "0.3000")
    @DecimalMin(value = "0.0000", message = "currentDesignStageRatio must be >= 0")
    @DecimalMax(value = "1.0000", message = "currentDesignStageRatio must be <= 1")
    private BigDecimal currentDesignStageRatio;

    @Schema(description = "审核审定是否外包", example = "false")
    private Boolean reviewOutsourceFlag;

    @Schema(description = "审核审定占比", example = "0.0600")
    @DecimalMin(value = "0.0000", message = "reviewOutsourceRatio must be >= 0")
    @DecimalMax(value = "1.0000", message = "reviewOutsourceRatio must be <= 1")
    private BigDecimal reviewOutsourceRatio;

    @Schema(description = "总分配比例", example = "1.0000")
    @DecimalMin(value = "0.0000", message = "totalDistributionAmount must be >= 0")
    @DecimalMax(value = "1.0000", message = "totalDistributionAmount must be <= 1")
    private BigDecimal totalDistributionAmount;

    @Schema(description = "提取进度备注", example = "Q1 提取安排")
    @Size(max = 500, message = "提取进度备注长度不能超过 500 个字符")
    private String progressRemark;

    @Schema(description = "楼栋数或户型数", example = "10")
    private Integer buildingOrUnitCount;

    @Schema(description = "套图系数，保留两位小数", example = "1.00")
    private BigDecimal drawingSetFactor;

    @Schema(description = "规模系数，保留两位小数", example = "1.00")
    private BigDecimal scaleFactor;

    @Schema(description = "修改系数，保留两位小数", example = "1.00")
    private BigDecimal modificationFactor;

    @Schema(description = "复杂系数/复杂等级，按比例值存储（100%=1.0000）", example = "1.0000")
    @DecimalMin(value = "0.0000", message = "complexityFactor must be >= 0")
    @DecimalMax(value = "1.0000", message = "complexityFactor must be <= 1")
    private BigDecimal complexityFactor;

    @Schema(description = "内部指导单价（元/m²）", example = "80.00")
    private BigDecimal internalGuidanceUnitPrice;

    @Schema(description = "虚拟产值计算方式：指导单价法/指导总价法/工日法", example = "工日法")
    @Size(max = 30, message = "虚拟产值计算方式长度不能超过 30 个字符")
    private String virtualCalculationMethod;

    @Schema(description = "工日", example = "100")
    private BigDecimal workingDayCount;

    @Schema(description = "工日单价", example = "1000.00")
    private BigDecimal workingDayUnitPrice;

    @Schema(description = "指导单价", example = "88.00")
    private BigDecimal guidanceUnitPrice;

    @Schema(description = "指导总价", example = "880000.00")
    private BigDecimal guidanceTotalPrice;

    @Schema(description = "产值计算比例", example = "0.0800")
    @DecimalMin(value = "0.0000", message = "calculationRatio must be >= 0")
    @DecimalMax(value = "1.0000", message = "calculationRatio must be <= 1")
    private BigDecimal calculationRatio;

}
