package org.innovateuk.ifs.finance.resource.cost;

import javax.validation.constraints.DecimalMin;
import java.math.BigDecimal;

public class AcademicCost extends AbstractFinanceRowItem {
    private Long id;
    private String name;

    @DecimalMin(value = "0", message = VALUE_MUST_BE_HIGHER_MESSAGE)
    private BigDecimal cost;

    private String item;

    public AcademicCost() {
    	// no-arg constructor
    }

    public AcademicCost(Long id, String name, BigDecimal cost, String item) {
        this();
        this.id = id;
        this.name = name;
        if(cost != null){
            this.cost = cost.setScale(2, BigDecimal.ROUND_HALF_UP);
        }
        this.item = item;
    }

    @Override
    public Long getId() {
        return id;
    }

    @Override
    public BigDecimal getTotal() {
        return cost;
    }

    @Override
    public FinanceRowType getCostType() {
        return FinanceRowType.ACADEMIC;
    }

    public String getItem() {
        return item;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public boolean isEmpty() {
        return false;
    }

    @Override
    public int getMinRows() {
        return 0;
    }

    public BigDecimal getCost() {
        return cost;
    }
}

@@ -271,36 +271,25 @@
 e = 
-VALUE_MUST_BE_HIGHER_MESSAGE
+NO_DECIMAL_VALUES
 )%0A  

change backend message to be equal to frontend message