GeneratedColumns.java

package com.tradecloud.domain.model.requestforquote;

public enum GeneratedColumns {
    //WAREHOUSE("Warehouse"),
    //ITEM_CODE("Item code"),
    //SIZE("Size"),
    //STYLE("STYLE", false, 0, ProductStockSaleType.OTHER),
    CODE("Code", false, 0, ProductStockSaleType.OTHER),
    BRAND("Brand", false, 0, ProductStockSaleType.OTHER),
    DESCRIPTION("Description", false, 0, ProductStockSaleType.OTHER),
    SOH_4_MONTHS("SOH - 4 Months", false, 4,ProductStockSaleType.STOCK),
    SOH_3_MONTHS("SOH - 3 Months", false, 3, ProductStockSaleType.STOCK),
    SOH_2_MONTHS("SOH - 2 Months", false, 2, ProductStockSaleType.STOCK),
    SOH_1_MONTH("SOH - 1 Month", false, 1, ProductStockSaleType.STOCK),
    TODAY_12_MONTHS("Today - 12 Months", false, 12, ProductStockSaleType.SALE),
    TODAY_11_MONTHS("Today - 11 Months", false, 11, ProductStockSaleType.SALE),
    TODAY_10_MONTHS("Today - 10 Months", false, 10, ProductStockSaleType.SALE),
    TODAY_9_MONTHS("Today - 9 Months", false, 9, ProductStockSaleType.SALE),
    TODAY_8_MONTHS("Today - 8 Months", false, 8, ProductStockSaleType.SALE),
    TODAY_7_MONTHS("Today - 7 Months", false, 7, ProductStockSaleType.SALE),
    TODAY_6_MONTHS("Today - 6 Months", false, 6, ProductStockSaleType.SALE),
    TODAY_5_MONTHS("Today - 5 Months", false, 5, ProductStockSaleType.SALE),
    TODAY_4_MONTHS("Today - 4 Months", false, 4, ProductStockSaleType.SALE),
    TODAY_3_MONTHS("Today - 3 Months", true, 3, ProductStockSaleType.SALE),
    TODAY_2_MONTHS("Today - 2 Months", true, 2, ProductStockSaleType.SALE),
    TODAY_1_MONTH("Today - 1 Months",true, 1, ProductStockSaleType.SALE),
    ACTUAL_SALES_CURRENT_PERIOD("Actual Sales Current Period", true,0, ProductStockSaleType.SALE),
    TWO_MONTH_AVG_SALES("2 Month Ave Sales", true, 0, ProductStockSaleType.AVERAGE),
    FOUR_MONTH_AVG_SALES("4 Month Ave Sales", true, 0, ProductStockSaleType.AVERAGE),
    SIX_MONTH_AVG_SALES("6 Month Ave Sales", true, 0, ProductStockSaleType.AVERAGE),
    BEST_SIX_MONTH_AVG_SALES("Best 6 Month Ave Sales", true, 0, ProductStockSaleType.AVERAGE),
    AVERAGE_USED("Average Used", true, 0, ProductStockSaleType.OTHER),
    ON_HAND("On Hand", true, 0, ProductStockSaleType.STOCK),
    MONTHS_SALES("Mth Bal Of Sales", true, 0, ProductStockSaleType.AVERAGE),
    ORDERS_SHIPPED("Orders Shipped", true, 0, ProductStockSaleType.AVERAGE),
    NEW_BALANCE("New Balance", true, 0, ProductStockSaleType.AVERAGE),
    ORDERS_NOT_SHIPPED("Orders Not Shipped", true, 0, ProductStockSaleType.AVERAGE),
    //BALANCE("balance", true, 0, ProductStockSaleType.AVERAGE),
    ORDERS_NOT_SHIPPED_1("Orders Not Shipped", true, 0, ProductStockSaleType.AVERAGE),
    BALANCE_1("Balance", true, 0, ProductStockSaleType.AVERAGE),
    ORDERS_NOT_SHIPPED_2("Orders Not Shipped", true, 0, ProductStockSaleType.AVERAGE),
    BALANCE_2("Balance", true, 0, ProductStockSaleType.AVERAGE),
    ORDERS_NOT_SHIPPED_3("Orders Not Shipped", true, 0, ProductStockSaleType.AVERAGE),
    BALANCE_3("Balance", true, 0, ProductStockSaleType.AVERAGE),
    FORECAST("Forecast", true, 0, ProductStockSaleType.AVERAGE),
    ORIGINAL_QUANTITY("Original Quantity", true, 0, ProductStockSaleType.OTHER),
    BRANCH_QUANTITY("Branch Quantity", false, 0, ProductStockSaleType.OTHER),
    RFQ_QUANTITY("RFQ Quantity", false, 0, ProductStockSaleType.OTHER);

    private final String description;

    private int monthFromToday;
    private boolean defaultShow;
    private ProductStockSaleType type;

    GeneratedColumns(String description, boolean defaultShow, int monthFromToday, ProductStockSaleType type) {
        this.description = description;
        this.monthFromToday=monthFromToday;
        this.defaultShow=defaultShow;
        this.type=type;
    }

    public String getDescription() {
        return description;
    }

    public int getMonthFromToday() {
        return monthFromToday;
    }

    public boolean isDefaultShow() {
        return defaultShow;
    }

    public ProductStockSaleType getType() {
        return type;
    }

    public boolean isStockOrSale(){
        return type==ProductStockSaleType.SALE||type==ProductStockSaleType.STOCK;
    }

    public boolean isAverage(){
        return type==ProductStockSaleType.AVERAGE;
    }

    public boolean isList(){
        return this==AVERAGE_USED;
    }

    public boolean isOriginalQuantity(){
        return this==ORIGINAL_QUANTITY;
    }

    public boolean isRfqQuantity(){
        return this==RFQ_QUANTITY;
    }

    public boolean isBranchQuantity(){
        return this==BRANCH_QUANTITY;
    }

    public static GeneratedColumns fromValue(String v) {
        for (GeneratedColumns c : GeneratedColumns.values()) {
            if (c.getDescription().equals(v)) {
                return c;
            }
        }
        throw new IllegalArgumentException(v);
    }

    @Override
    public String toString() {
        return this.name();
    }

    public boolean isMonthAverage(){
        return this==TWO_MONTH_AVG_SALES||this==SIX_MONTH_AVG_SALES||this==FOUR_MONTH_AVG_SALES;
    }

    public boolean isQuantityCol(){
        return this==BRANCH_QUANTITY||this==ORIGINAL_QUANTITY||this==RFQ_QUANTITY;
    }
}