package cn.iocoder.lyzsys.module.tjt.enums;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/**
 * 合约规划业务类型常量
 *
 * @author Codex
 */
public final class ProjectPlanningBizTypeConstants {

    public static final String OWNERSHIP_TYPE_MAJOR = "专业所";
    public static final String OWNERSHIP_TYPE_COMPREHENSIVE = "综合所";
    public static final String OWNERSHIP_TYPE_SPECIAL_SUBCONTRACT = "专项分包";
    public static final String OWNERSHIP_TYPE_SOURCE_COOP_SUBCONTRACT = "源头合作分包";
    public static final String DESIGN_PART_REAL_ESTATE = "地上部分";
    public static final String DESIGN_PART_UNDERGROUND = "地下部分";
    public static final String DESIGN_PART_OTHER = "其他";

    public static final String CALCULATION_METHOD_GUIDANCE_PRICE = "指导价法";
    public static final String CALCULATION_METHOD_CONTRACT_PRICE = "合同价法";
    public static final String CALCULATION_METHOD_VIRTUAL_OUTPUT = "虚拟产值法";

    public static final String VIRTUAL_CALCULATION_METHOD_GUIDANCE_PRICE = "指导单价法";
    public static final String VIRTUAL_CALCULATION_METHOD_GUIDANCE_TOTAL_PRICE = "指导总价法";
    public static final String VIRTUAL_CALCULATION_METHOD_WORKING_DAY = "工日法";

    private static final Set<String> OWNERSHIP_TYPES = new HashSet<>(Arrays.asList(
            OWNERSHIP_TYPE_MAJOR,
            OWNERSHIP_TYPE_COMPREHENSIVE,
            OWNERSHIP_TYPE_SPECIAL_SUBCONTRACT,
            OWNERSHIP_TYPE_SOURCE_COOP_SUBCONTRACT
    ));

    private static final Set<String> CALCULATION_METHODS = new HashSet<>(Arrays.asList(
            CALCULATION_METHOD_GUIDANCE_PRICE,
            CALCULATION_METHOD_CONTRACT_PRICE,
            CALCULATION_METHOD_VIRTUAL_OUTPUT
    ));

    private static final Set<String> DESIGN_PARTS = new HashSet<>(Arrays.asList(
            DESIGN_PART_REAL_ESTATE,
            DESIGN_PART_UNDERGROUND,
            DESIGN_PART_OTHER
    ));

    private static final Set<String> VIRTUAL_CALCULATION_METHODS = new HashSet<>(Arrays.asList(
            VIRTUAL_CALCULATION_METHOD_GUIDANCE_PRICE,
            VIRTUAL_CALCULATION_METHOD_GUIDANCE_TOTAL_PRICE,
            VIRTUAL_CALCULATION_METHOD_WORKING_DAY
    ));

    private ProjectPlanningBizTypeConstants() {
    }

    public static boolean isValidOwnershipType(String value) {
        return OWNERSHIP_TYPES.contains(value);
    }

    public static boolean isValidCalculationMethod(String value) {
        return CALCULATION_METHODS.contains(value);
    }

    public static boolean isValidDesignPart(String value) {
        return DESIGN_PARTS.contains(value);
    }

    public static boolean isValidVirtualCalculationMethod(String value) {
        return VIRTUAL_CALCULATION_METHODS.contains(value);
    }

    public static boolean isMajor(String value) {
        return OWNERSHIP_TYPE_MAJOR.equals(value);
    }

    public static boolean isComprehensive(String value) {
        return OWNERSHIP_TYPE_COMPREHENSIVE.equals(value);
    }

    public static boolean isSubcontract(String value) {
        return isSpecialSubcontract(value) || isSourceCoopSubcontract(value);
    }

    public static boolean isSpecialSubcontract(String value) {
        return OWNERSHIP_TYPE_SPECIAL_SUBCONTRACT.equals(value);
    }

    public static boolean isSourceCoopSubcontract(String value) {
        return OWNERSHIP_TYPE_SOURCE_COOP_SUBCONTRACT.equals(value);
    }

    public static boolean isGuidancePrice(String value) {
        return CALCULATION_METHOD_GUIDANCE_PRICE.equals(value);
    }

    public static boolean isMajorGuidanceScene(String ownershipType, String calculationMethod) {
        return isMajor(ownershipType) && isGuidancePrice(calculationMethod);
    }

    public static boolean isContractPrice(String value) {
        return CALCULATION_METHOD_CONTRACT_PRICE.equals(value);
    }

    public static boolean isVirtualOutput(String value) {
        return CALCULATION_METHOD_VIRTUAL_OUTPUT.equals(value);
    }

    public static boolean isWorkingDay(String value) {
        return VIRTUAL_CALCULATION_METHOD_WORKING_DAY.equals(value);
    }

    public static boolean isVirtualGuidancePrice(String value) {
        return VIRTUAL_CALCULATION_METHOD_GUIDANCE_PRICE.equals(value);
    }

    public static boolean isVirtualGuidanceTotalPrice(String value) {
        return VIRTUAL_CALCULATION_METHOD_GUIDANCE_TOTAL_PRICE.equals(value);
    }

}
