package api.unicore.component;
 
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.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_manual.MerchantRemittanceInfo;
import api.util.BooleanFormat;
import api.util.IntegerFormat;
import api.util.StringFormat;
import iapp.services.ServerObject;
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 [Vladimir Danovskyi ]
 * @company UnitedThinkers
 * @since 2012/04/05
 */
 
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"remittanceMode", "remittanceBasis", "isMerchantStatementReviewEnabled", "isResellerStatementReviewEnabled", "processingCutoff", "dataExportPolicy"})
@JsonPropertyOrder({"remittanceMode", "remittanceBasis", "isMerchantStatementReviewEnabled", "isResellerStatementReviewEnabled", "processingCutoff", "dataExportPolicy"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(MerchantRemittanceInfo.class)
public abstract class AbstractMerchantRemittanceInfo extends UnoComponent<unicore.model.Merchant> {
 
    @FormParam("remittanceMode")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String remittanceMode;
 
    @FormParam("remittanceBasis")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String remittanceBasis;
 
    @FormParam("isMerchantStatementReviewEnabled")
    @BooleanFormat
    @DefaultValue(BOOLEAN_NULL_CODE)
    protected Boolean isMerchantStatementReviewEnabled;
 
    @FormParam("isResellerStatementReviewEnabled")
    @BooleanFormat
    @DefaultValue(BOOLEAN_NULL_CODE)
    protected Boolean isResellerStatementReviewEnabled;
 
    @FormParam("processingCutoff")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer processingCutoff;
 
    @FormParam("dataExportPolicy")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String dataExportPolicy;
 
 
    public AbstractMerchantRemittanceInfo(){
        super();
        applyDefaults();
    }
 
    public AbstractMerchantRemittanceInfo(unicore.model.Merchant object){
        super(object);
    }
 
 
    private void applyDefaults() {
        if (!isProxyObject()) {
            remittanceMode = STRING_NULL;
            remittanceBasis = STRING_NULL;
            isMerchantStatementReviewEnabled = BOOLEAN_NULL;
            isResellerStatementReviewEnabled = BOOLEAN_NULL;
            processingCutoff = INTEGER_NULL;
            dataExportPolicy = STRING_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("remittance: {");
        sb.append("remittanceMode: ");
        sb.append(remittanceMode);
        sb.append(',').append(' ');
        sb.append("remittanceBasis: ");
        sb.append(remittanceBasis);
        sb.append(',').append(' ');
        sb.append("isMerchantStatementReviewEnabled: ");
        sb.append(isMerchantStatementReviewEnabled);
        sb.append(',').append(' ');
        sb.append("isResellerStatementReviewEnabled: ");
        sb.append(isResellerStatementReviewEnabled);
        sb.append(',').append(' ');
        sb.append("processingCutoff: ");
        sb.append(processingCutoff);
        sb.append(',').append(' ');
        sb.append("dataExportPolicy: ");
        sb.append(dataExportPolicy);
        sb.append('}');
        return sb.toString();
    }
 
 
    @XmlAttribute(name="remittanceMode")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("remittanceMode")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    public String getRemittanceMode(){
        return remittanceMode;
    }
 
    public void setRemittanceMode(String value){
        this.remittanceMode = value;
    }
 
    @XmlAttribute(name="remittanceBasis")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("remittanceBasis")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    public String getRemittanceBasis(){
        return remittanceBasis;
    }
 
    public void setRemittanceBasis(String value){
        this.remittanceBasis = value;
    }
 
    @XmlAttribute(name="isMerchantStatementReviewEnabled")
    @FormParam("isMerchantStatementReviewEnabled")
    @BooleanFormat
    public Boolean getIsMerchantStatementReviewEnabled(){
        return isMerchantStatementReviewEnabled;
    }
 
    public void setIsMerchantStatementReviewEnabled(Boolean value){
        this.isMerchantStatementReviewEnabled = value;
    }
 
    @XmlAttribute(name="isResellerStatementReviewEnabled")
    @FormParam("isResellerStatementReviewEnabled")
    @BooleanFormat
    public Boolean getIsResellerStatementReviewEnabled(){
        return isResellerStatementReviewEnabled;
    }
 
    public void setIsResellerStatementReviewEnabled(Boolean value){
        this.isResellerStatementReviewEnabled = value;
    }
 
    @XmlAttribute(name="processingCutoff")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("processingCutoff")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    public Integer getProcessingCutoff(){
        return processingCutoff;
    }
 
    public void setProcessingCutoff(Integer value){
        this.processingCutoff = value;
    }
 
    @XmlAttribute(name="dataExportPolicy")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("dataExportPolicy")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    public String getDataExportPolicy(){
        return dataExportPolicy;
    }
 
    public void setDataExportPolicy(String value){
        this.dataExportPolicy = value;
    }
 
 
    public void audit(AuditHelper helper, ServerObject object) {
        unicore.model.Merchant s_object = (unicore.model.Merchant) object;
        helper.audit("remittanceMode", remittanceMode, s_object.getRemittanceModeCl() == null ? null : s_object.getRemittanceModeCl().getValue());
        helper.audit("remittanceBasis", remittanceBasis, s_object.getRemittanceBasisCl() == null ? null : s_object.getRemittanceBasisCl().getValue());
        helper.audit("isMerchantStatementReviewEnabled", isMerchantStatementReviewEnabled, s_object.getIsMerchantStatementReviewRequired());
        helper.audit("isResellerStatementReviewEnabled", isResellerStatementReviewEnabled, s_object.getIsResellerStatementReviewRequired());
        helper.audit("processingCutoff", processingCutoff, s_object.getProcessingCutoff());
        helper.audit("dataExportPolicy", dataExportPolicy, s_object.getDataExportPolicy());
 
    }
 
    public static String objectTypeCode(){
        return "remittance-info";
    }
 
}