package api.unicore.component.fees;
 
import static api.util.ComponentConstants.INTEGER_NULL;
import static api.util.ComponentConstants.INTEGER_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.unicore.component.fees_manual.FeeCycle;
import api.util.IntegerFormat;
import api.util.StringFormat;
import iapp.util.audit.AuditHelper;
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 [Liza Zhydok]
 * @company UnitedThinkers
 * @since 2013/03/01
 */
 
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"days", "monthlyFeeDay"})
@JsonPropertyOrder({"days", "monthlyFeeDay"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(FeeCycle.class)
public abstract class AbstractFeeCycle {
 
    @FormParam("days")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String days = STRING_NULL;
 
    @FormParam("monthlyFeeDay")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer monthlyFeeDay = INTEGER_NULL;
 
 
    public AbstractFeeCycle(){
    }
 
    public String toString(){
        StringBuilder sb = new StringBuilder();
        sb.append("cycle: {");
        sb.append("days: ");
        sb.append(days);
        sb.append(',').append(' ');
        sb.append("monthlyFeeDay: ");
        sb.append(monthlyFeeDay);
        sb.append('}');
        return sb.toString();
    }
 
 
    @XmlAttribute(name="days")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("days")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    public String getDays(){
        return days;
    }
 
    public void setDays(String value){
        this.days = value;
    }
 
    @XmlAttribute(name="monthlyFeeDay")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("monthlyFeeDay")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    public Integer getMonthlyFeeDay(){
        return monthlyFeeDay;
    }
 
    public void setMonthlyFeeDay(Integer value){
        this.monthlyFeeDay = value;
    }
 
 
    public void audit(AuditHelper helper, AbstractFeeCycle old) {
        helper.audit("days", days, old.getDays());
        helper.audit("monthlyFeeDay", monthlyFeeDay, old.getMonthlyFeeDay());
    }
 
}