package api.unicore.component.fees;
 
import static api.util.ComponentConstants.BOOLEAN_NULL;
import static api.util.ComponentConstants.BOOLEAN_NULL_CODE;
import static api.util.ComponentConstants.INTEGER_NULL;
import static api.util.ComponentConstants.INTEGER_NULL_CODE;
import static api.util.ComponentConstants.LONG_NULL;
import static api.util.ComponentConstants.LONG_NULL_CODE;
import static api.util.ComponentConstants.STRING_NULL;
import static api.util.ComponentConstants.STRING_NULL_CODE;
import static org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_NULL;
 
import api.UnoComponent;
import api.unicore.component.fees_manual.ConvenienceFee;
import api.util.BooleanFormat;
import api.util.IntegerFormat;
import api.util.LongFormat;
import api.util.StringFormat;
import iapp.services.ServerObject;
import iapp.util.audit.AuditHelper;
import javax.validation.constraints.Min;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.FormParam;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.codehaus.jackson.annotate.JsonPropertyOrder;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
 
/**
 * @author CodeGen [Aleksey Kostetsky]
 * @company UnitedThinkers
 * @since 2015/09/21
 */
 
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"id", "accountProcessingPolicy", "processingCost", "amountLevel1", "percentageLevel1", "thresholdLevel1", "amountLevel2", "percentageLevel2", "thresholdLevel2", "amountLevel3", "percentageLevel3", "thresholdLevel3", "amountLevel4", "percentageLevel4", "thresholdLevel4", "amountLevel5", "percentageLevel5", "isActive"})
@JsonPropertyOrder({"id", "accountProcessingPolicy", "processingCost", "amountLevel1", "percentageLevel1", "thresholdLevel1", "amountLevel2", "percentageLevel2", "thresholdLevel2", "amountLevel3", "percentageLevel3", "thresholdLevel3", "amountLevel4", "percentageLevel4", "thresholdLevel4", "amountLevel5", "percentageLevel5", "isActive"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(ConvenienceFee.class)
public abstract class AbstractConvenienceFee extends UnoComponent<unicharge.model.ConvenienceFee> {
 
    @FormParam("id")
    @LongFormat
    @DefaultValue(LONG_NULL_CODE)
    protected Long id;
 
    @FormParam("accountProcessingPolicy")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String accountProcessingPolicy;
 
    @FormParam("processingCost")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String processingCost;
 
    @FormParam("amountLevel1")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer amountLevel1;
 
    @FormParam("percentageLevel1")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer percentageLevel1;
 
    @FormParam("thresholdLevel1")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer thresholdLevel1;
 
    @FormParam("amountLevel2")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer amountLevel2;
 
    @FormParam("percentageLevel2")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer percentageLevel2;
 
    @FormParam("thresholdLevel2")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer thresholdLevel2;
 
    @FormParam("amountLevel3")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer amountLevel3;
 
    @FormParam("percentageLevel3")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer percentageLevel3;
 
    @FormParam("thresholdLevel3")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer thresholdLevel3;
 
    @FormParam("amountLevel4")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer amountLevel4;
 
    @FormParam("percentageLevel4")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer percentageLevel4;
 
    @FormParam("thresholdLevel4")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer thresholdLevel4;
 
    @FormParam("amountLevel5")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer amountLevel5;
 
    @FormParam("percentageLevel5")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer percentageLevel5;
 
    @FormParam("isActive")
    @BooleanFormat
    @DefaultValue(BOOLEAN_NULL_CODE)
    protected Boolean isActive;
 
 
    public AbstractConvenienceFee(){
        super();
        applyDefaults();
    }
 
    public AbstractConvenienceFee(unicharge.model.ConvenienceFee object){
        super(object);
    }
 
 
    private void applyDefaults() {
        if (!isProxyObject()) {
            id = LONG_NULL;
            accountProcessingPolicy = STRING_NULL;
            processingCost = STRING_NULL;
            amountLevel1 = INTEGER_NULL;
            percentageLevel1 = INTEGER_NULL;
            thresholdLevel1 = INTEGER_NULL;
            amountLevel2 = INTEGER_NULL;
            percentageLevel2 = INTEGER_NULL;
            thresholdLevel2 = INTEGER_NULL;
            amountLevel3 = INTEGER_NULL;
            percentageLevel3 = INTEGER_NULL;
            thresholdLevel3 = INTEGER_NULL;
            amountLevel4 = INTEGER_NULL;
            percentageLevel4 = INTEGER_NULL;
            thresholdLevel4 = INTEGER_NULL;
            amountLevel5 = INTEGER_NULL;
            percentageLevel5 = INTEGER_NULL;
            isActive = BOOLEAN_NULL;
        }
    }
 
    @Override
    public void from() {
        fromInternal();
        super.from();
    }
 
    protected abstract void fromInternal();
    @Override
    public abstract void to();
    @Override
    public abstract void initializeNew();
 
    @Override
    public String toString(){
        StringBuilder sb = new StringBuilder();
        sb.append("convenienceFee: {");
        sb.append("id: ");
        sb.append(id);
        sb.append(',').append(' ');
        sb.append("accountProcessingPolicy: ");
        sb.append(accountProcessingPolicy);
        sb.append(',').append(' ');
        sb.append("processingCost: ");
        sb.append(processingCost);
        sb.append(',').append(' ');
        sb.append("amountLevel1: ");
        sb.append(amountLevel1);
        sb.append(',').append(' ');
        sb.append("percentageLevel1: ");
        sb.append(percentageLevel1);
        sb.append(',').append(' ');
        sb.append("thresholdLevel1: ");
        sb.append(thresholdLevel1);
        sb.append(',').append(' ');
        sb.append("amountLevel2: ");
        sb.append(amountLevel2);
        sb.append(',').append(' ');
        sb.append("percentageLevel2: ");
        sb.append(percentageLevel2);
        sb.append(',').append(' ');
        sb.append("thresholdLevel2: ");
        sb.append(thresholdLevel2);
        sb.append(',').append(' ');
        sb.append("amountLevel3: ");
        sb.append(amountLevel3);
        sb.append(',').append(' ');
        sb.append("percentageLevel3: ");
        sb.append(percentageLevel3);
        sb.append(',').append(' ');
        sb.append("thresholdLevel3: ");
        sb.append(thresholdLevel3);
        sb.append(',').append(' ');
        sb.append("amountLevel4: ");
        sb.append(amountLevel4);
        sb.append(',').append(' ');
        sb.append("percentageLevel4: ");
        sb.append(percentageLevel4);
        sb.append(',').append(' ');
        sb.append("thresholdLevel4: ");
        sb.append(thresholdLevel4);
        sb.append(',').append(' ');
        sb.append("amountLevel5: ");
        sb.append(amountLevel5);
        sb.append(',').append(' ');
        sb.append("percentageLevel5: ");
        sb.append(percentageLevel5);
        sb.append(',').append(' ');
        sb.append("isActive: ");
        sb.append(isActive);
        sb.append('}');
        return sb.toString();
    }
 
 
    @XmlAttribute(name="id")
    @XmlJavaTypeAdapter(value=api.util.LongAdapter.class, type=Long.class)
    @FormParam("id")
    @LongFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Long getId(){
        return id;
    }
 
    public void setId(Long value){
        this.id = value;
    }
 
    @XmlAttribute(name="accountProcessingPolicy")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("accountProcessingPolicy")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    public String getAccountProcessingPolicy(){
        return accountProcessingPolicy;
    }
 
    public void setAccountProcessingPolicy(String value){
        this.accountProcessingPolicy = value;
    }
 
    @XmlAttribute(name="processingCost")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("processingCost")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    public String getProcessingCost(){
        return processingCost;
    }
 
    public void setProcessingCost(String value){
        this.processingCost = value;
    }
 
    @XmlAttribute(name="amountLevel1")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("amountLevel1")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getAmountLevel1(){
        return amountLevel1;
    }
 
    public void setAmountLevel1(Integer value){
        this.amountLevel1 = value;
    }
 
    @XmlAttribute(name="percentageLevel1")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("percentageLevel1")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getPercentageLevel1(){
        return percentageLevel1;
    }
 
    public void setPercentageLevel1(Integer value){
        this.percentageLevel1 = value;
    }
 
    @XmlAttribute(name="thresholdLevel1")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("thresholdLevel1")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getThresholdLevel1(){
        return thresholdLevel1;
    }
 
    public void setThresholdLevel1(Integer value){
        this.thresholdLevel1 = value;
    }
 
    @XmlAttribute(name="amountLevel2")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("amountLevel2")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getAmountLevel2(){
        return amountLevel2;
    }
 
    public void setAmountLevel2(Integer value){
        this.amountLevel2 = value;
    }
 
    @XmlAttribute(name="percentageLevel2")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("percentageLevel2")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getPercentageLevel2(){
        return percentageLevel2;
    }
 
    public void setPercentageLevel2(Integer value){
        this.percentageLevel2 = value;
    }
 
    @XmlAttribute(name="thresholdLevel2")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("thresholdLevel2")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getThresholdLevel2(){
        return thresholdLevel2;
    }
 
    public void setThresholdLevel2(Integer value){
        this.thresholdLevel2 = value;
    }
 
    @XmlAttribute(name="amountLevel3")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("amountLevel3")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getAmountLevel3(){
        return amountLevel3;
    }
 
    public void setAmountLevel3(Integer value){
        this.amountLevel3 = value;
    }
 
    @XmlAttribute(name="percentageLevel3")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("percentageLevel3")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getPercentageLevel3(){
        return percentageLevel3;
    }
 
    public void setPercentageLevel3(Integer value){
        this.percentageLevel3 = value;
    }
 
    @XmlAttribute(name="thresholdLevel3")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("thresholdLevel3")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getThresholdLevel3(){
        return thresholdLevel3;
    }
 
    public void setThresholdLevel3(Integer value){
        this.thresholdLevel3 = value;
    }
 
    @XmlAttribute(name="amountLevel4")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("amountLevel4")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getAmountLevel4(){
        return amountLevel4;
    }
 
    public void setAmountLevel4(Integer value){
        this.amountLevel4 = value;
    }
 
    @XmlAttribute(name="percentageLevel4")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("percentageLevel4")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getPercentageLevel4(){
        return percentageLevel4;
    }
 
    public void setPercentageLevel4(Integer value){
        this.percentageLevel4 = value;
    }
 
    @XmlAttribute(name="thresholdLevel4")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("thresholdLevel4")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getThresholdLevel4(){
        return thresholdLevel4;
    }
 
    public void setThresholdLevel4(Integer value){
        this.thresholdLevel4 = value;
    }
 
    @XmlAttribute(name="amountLevel5")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("amountLevel5")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getAmountLevel5(){
        return amountLevel5;
    }
 
    public void setAmountLevel5(Integer value){
        this.amountLevel5 = value;
    }
 
    @XmlAttribute(name="percentageLevel5")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("percentageLevel5")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getPercentageLevel5(){
        return percentageLevel5;
    }
 
    public void setPercentageLevel5(Integer value){
        this.percentageLevel5 = value;
    }
 
    @XmlAttribute(name="isActive")
    @FormParam("isActive")
    @BooleanFormat
    public Boolean getIsActive(){
        return isActive;
    }
 
    public void setIsActive(Boolean value){
        this.isActive = value;
    }
 
 
    public void audit(AuditHelper helper, ServerObject object) {
        unicharge.model.ConvenienceFee s_object = (unicharge.model.ConvenienceFee) object;
        helper.audit("id", id, s_object.getId());
        helper.audit("accountProcessingPolicy", accountProcessingPolicy, s_object.getAccountProcessingPolicy());
        helper.audit("processingCost", processingCost, s_object.getProcessingCostCl() == null ? null : s_object.getProcessingCostCl().getValue());
        helper.audit("amountLevel1", amountLevel1, s_object.getAmountLevel1());
        helper.audit("percentageLevel1", percentageLevel1, s_object.getPercentageLevel1());
        helper.audit("thresholdLevel1", thresholdLevel1, s_object.getThresholdLevel1());
        helper.audit("amountLevel2", amountLevel2, s_object.getAmountLevel2());
        helper.audit("percentageLevel2", percentageLevel2, s_object.getPercentageLevel2());
        helper.audit("thresholdLevel2", thresholdLevel2, s_object.getThresholdLevel2());
        helper.audit("amountLevel3", amountLevel3, s_object.getAmountLevel3());
        helper.audit("percentageLevel3", percentageLevel3, s_object.getPercentageLevel3());
        helper.audit("thresholdLevel3", thresholdLevel3, s_object.getThresholdLevel3());
        helper.audit("amountLevel4", amountLevel4, s_object.getAmountLevel4());
        helper.audit("percentageLevel4", percentageLevel4, s_object.getPercentageLevel4());
        helper.audit("thresholdLevel4", thresholdLevel4, s_object.getThresholdLevel4());
        helper.audit("amountLevel5", amountLevel5, s_object.getAmountLevel5());
        helper.audit("percentageLevel5", percentageLevel5, s_object.getPercentageLevel5());
        helper.audit("isActive", isActive, s_object.getIsActive());
 
    }
 
    public static String objectTypeCode(){
        return "fees/convenience";
    }
 
}