package api.unicharge.component;
 
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.unicharge.component_manual.TerminalOrderDetail;
import api.unicore.VirtualFields;
import api.util.LongFormat;
import api.util.StringFormat;
import iapp.services.ServerObject;
import iapp.util.audit.AuditHelper;
import javax.validation.constraints.NotNull;
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 2015/10/05
 */
 
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"id", "terminalCode", "terminalModel", "terminalKeyCode", "terminalConfigurationCode", "serialNumber", "returnSerialNumber", "itemNumber"})
@JsonPropertyOrder({"id", "terminalCode", "terminalModel", "terminalKeyCode", "terminalConfigurationCode", "serialNumber", "returnSerialNumber", "itemNumber"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(TerminalOrderDetail.class)
public abstract class AbstractTerminalOrderDetail extends UnoComponent<unicharge.model.TerminalOrderDetail> {
 
    @FormParam("id")
    @LongFormat
    @DefaultValue(LONG_NULL_CODE)
    protected Long id;
 
    @FormParam("terminalCode")
    @LongFormat
    @DefaultValue(LONG_NULL_CODE)
    protected Long terminalCode;
 
    @FormParam("terminalModel")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String terminalModel;
 
    @FormParam("terminalKeyCode")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String terminalKeyCode;
 
    @FormParam("terminalConfigurationCode")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String terminalConfigurationCode;
 
    @FormParam("serialNumber")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String serialNumber;
 
    @FormParam("returnSerialNumber")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String returnSerialNumber;
 
    @FormParam("itemNumber")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String itemNumber;
 
 
    public AbstractTerminalOrderDetail(){
        super();
        applyDefaults();
    }
 
    public AbstractTerminalOrderDetail(unicharge.model.TerminalOrderDetail object){
        super(object);
    }
 
 
    private void applyDefaults() {
        if (!isProxyObject()) {
            id = LONG_NULL;
            terminalCode = LONG_NULL;
            terminalModel = STRING_NULL;
            terminalKeyCode = STRING_NULL;
            terminalConfigurationCode = STRING_NULL;
            serialNumber = STRING_NULL;
            returnSerialNumber = STRING_NULL;
            itemNumber = 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("terminalOrderDetail: {");
        sb.append("id: ");
        sb.append(id);
        sb.append(',').append(' ');
        sb.append("terminalCode: ");
        sb.append(terminalCode);
        sb.append(',').append(' ');
        sb.append("terminalModel: ");
        sb.append(terminalModel);
        sb.append(',').append(' ');
        sb.append("terminalKeyCode: ");
        sb.append(terminalKeyCode);
        sb.append(',').append(' ');
        sb.append("terminalConfigurationCode: ");
        sb.append(terminalConfigurationCode);
        sb.append(',').append(' ');
        sb.append("serialNumber: ");
        sb.append(serialNumber);
        sb.append(',').append(' ');
        sb.append("returnSerialNumber: ");
        sb.append(returnSerialNumber);
        sb.append(',').append(' ');
        sb.append("itemNumber: ");
        sb.append(itemNumber);
        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="terminalCode")
    @XmlJavaTypeAdapter(value=api.util.LongAdapter.class, type=Long.class)
    @FormParam("terminalCode")
    @LongFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @NotNull
    public Long getTerminalCode(){
        return terminalCode;
    }
 
    public void setTerminalCode(Long value){
        this.terminalCode = value;
    }
 
    @XmlAttribute(name="terminalModel")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("terminalModel")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @NotNull
    public String getTerminalModel(){
        return terminalModel;
    }
 
    public void setTerminalModel(String value){
        this.terminalModel = value;
    }
 
    @XmlAttribute(name="terminalKeyCode")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("terminalKeyCode")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @NotNull
    public String getTerminalKeyCode(){
        return terminalKeyCode;
    }
 
    public void setTerminalKeyCode(String value){
        this.terminalKeyCode = value;
    }
 
    @XmlAttribute(name="terminalConfigurationCode")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("terminalConfigurationCode")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @NotNull
    public String getTerminalConfigurationCode(){
        return terminalConfigurationCode;
    }
 
    public void setTerminalConfigurationCode(String value){
        this.terminalConfigurationCode = value;
    }
 
    @XmlAttribute(name="serialNumber")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("serialNumber")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    public String getSerialNumber(){
        return serialNumber;
    }
 
    public void setSerialNumber(String value){
        this.serialNumber = value;
    }
 
    @XmlAttribute(name="returnSerialNumber")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("returnSerialNumber")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    public String getReturnSerialNumber(){
        return returnSerialNumber;
    }
 
    public void setReturnSerialNumber(String value){
        this.returnSerialNumber = value;
    }
 
    @XmlAttribute(name="itemNumber")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("itemNumber")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    public String getItemNumber(){
        return itemNumber;
    }
 
    public void setItemNumber(String value){
        this.itemNumber = value;
    }
 
 
    public void audit(AuditHelper helper, ServerObject object) {
        unicharge.model.TerminalOrderDetail s_object = (unicharge.model.TerminalOrderDetail) object;
        helper.audit("id", id, s_object.getId());
        helper.audit("terminalCode", terminalCode, s_object.getTerminalCode());
        helper.audit("terminalModel", terminalModel, s_object.getModelCl() == null ? null : s_object.getModelCl().getValue());
        helper.audit("terminalKeyCode", terminalKeyCode, VirtualFields.TerminalKeyCode.get(s_object));
        helper.audit("terminalConfigurationCode", terminalConfigurationCode, s_object.getTerminalConfigurationCode());
        helper.audit("serialNumber", serialNumber, s_object.getSerialNumber());
        helper.audit("returnSerialNumber", returnSerialNumber, s_object.getReturnSerialNumber());
        helper.audit("itemNumber", itemNumber, s_object.getItemNumber());
 
    }
 
 
}