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.DATE_NULL;
import static api.util.ComponentConstants.DATE_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.unicore.component.fees_manual.CommissionPolicy;
import api.util.BooleanFormat;
import api.util.DateFormat;
import api.util.LongFormat;
import api.util.StringFormat;
import iapp.util.audit.AuditHelper;
import java.util.Date;
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/05/21
 */
 
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"id", "isActive", "startDate", "endDate", "resellerId", "resellerCode", "resellerName"})
@JsonPropertyOrder({"id", "isActive", "startDate", "endDate", "resellerId", "resellerCode", "resellerName"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(CommissionPolicy.class)
public abstract class AbstractCommissionPolicy {
 
    @FormParam("id")
    @LongFormat
    @DefaultValue(LONG_NULL_CODE)
    protected Long id = LONG_NULL;
 
    @FormParam("isActive")
    @BooleanFormat
    @DefaultValue(BOOLEAN_NULL_CODE)
    protected Boolean isActive = BOOLEAN_NULL;
 
    @FormParam("startDate")
    @DateFormat
    @DefaultValue(DATE_NULL_CODE)
    protected Date startDate = DATE_NULL;
 
    @FormParam("endDate")
    @DateFormat
    @DefaultValue(DATE_NULL_CODE)
    protected Date endDate = DATE_NULL;
 
    @FormParam("resellerId")
    @LongFormat
    @DefaultValue(LONG_NULL_CODE)
    protected Long resellerId = LONG_NULL;
 
    @FormParam("resellerCode")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String resellerCode = STRING_NULL;
 
    @FormParam("resellerName")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String resellerName = STRING_NULL;
 
 
    public AbstractCommissionPolicy(){
    }
 
    public String toString(){
        StringBuilder sb = new StringBuilder();
        sb.append("policy: {");
        sb.append("id: ");
        sb.append(id);
        sb.append(',').append(' ');
        sb.append("isActive: ");
        sb.append(isActive);
        sb.append(',').append(' ');
        sb.append("startDate: ");
        sb.append(startDate);
        sb.append(',').append(' ');
        sb.append("endDate: ");
        sb.append(endDate);
        sb.append(',').append(' ');
        sb.append("resellerId: ");
        sb.append(resellerId);
        sb.append(',').append(' ');
        sb.append("resellerCode: ");
        sb.append(resellerCode);
        sb.append(',').append(' ');
        sb.append("resellerName: ");
        sb.append(resellerName);
        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)
    public Long getId(){
        return id;
    }
 
    public void setId(Long value){
        this.id = value;
    }
 
    @XmlAttribute(name="isActive")
    @FormParam("isActive")
    @BooleanFormat
    public Boolean getIsActive(){
        return isActive;
    }
 
    public void setIsActive(Boolean value){
        this.isActive = value;
    }
 
    @XmlAttribute(name="startDate")
    @FormParam("startDate")
    @DateFormat
    @JsonDeserialize(using=api.util.DateDeserializer.class)
    public Date getStartDate(){
        return startDate;
    }
 
    public void setStartDate(Date value){
        this.startDate = value;
    }
 
    @XmlAttribute(name="endDate")
    @FormParam("endDate")
    @DateFormat
    @JsonDeserialize(using=api.util.DateDeserializer.class)
    public Date getEndDate(){
        return endDate;
    }
 
    public void setEndDate(Date value){
        this.endDate = value;
    }
 
    @XmlAttribute(name="resellerId")
    @XmlJavaTypeAdapter(value=api.util.LongAdapter.class, type=Long.class)
    @FormParam("resellerId")
    @LongFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    public Long getResellerId(){
        return resellerId;
    }
 
    public void setResellerId(Long value){
        this.resellerId = value;
    }
 
    @XmlAttribute(name="resellerCode")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("resellerCode")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    public String getResellerCode(){
        return resellerCode;
    }
 
    public void setResellerCode(String value){
        this.resellerCode = value;
    }
 
    @XmlAttribute(name="resellerName")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("resellerName")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    public String getResellerName(){
        return resellerName;
    }
 
    public void setResellerName(String value){
        this.resellerName = value;
    }
 
 
    public void audit(AuditHelper helper, AbstractCommissionPolicy old) {
        helper.audit("id", id, old.getId());
        helper.audit("isActive", isActive, old.getIsActive());
        helper.audit("startDate", startDate, old.getStartDate());
        helper.audit("endDate", endDate, old.getEndDate());
        helper.audit("resellerId", resellerId, old.getResellerId());
        helper.audit("resellerCode", resellerCode, old.getResellerCode());
        helper.audit("resellerName", resellerName, old.getResellerName());
    }
 
}