package api.unibill.component;
 
import static api.util.ComponentConstants.DATE_NULL;
import static api.util.ComponentConstants.DATE_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_manual.ProcessingRequest;
import api.util.DateFormat;
import api.util.IntegerFormat;
import api.util.LongFormat;
import api.util.StringFormat;
import java.util.Date;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
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;
import unipay.fields_manual.Fields;
import unipay.validator.CustomValidator;
import unipay.validator.EnumValidator;
import unipay.validator.SensitiveDataValidator;
 
/**
 * @author CodeGen [Anton Shershnov]
 * @company UnitedThinkers
 * @since 2018/07/24
 */
 
@JsonSerialize(include=NON_NULL)
@XmlType(propOrder={"id", "holderName", "accountData", "accountNumber", "accountAccessory", "token", "csc", "street", "city", "state", "zipCode", "countryCode", "phone", "email", "dueDate", "type", "accountType", "creatorCode", "amount", "note", "accountId", "code", "feeAmount"})
@JsonPropertyOrder({"id", "holderName", "accountData", "accountNumber", "accountAccessory", "token", "csc", "street", "city", "state", "zipCode", "countryCode", "phone", "email", "dueDate", "type", "accountType", "creatorCode", "amount", "note", "accountId", "code", "feeAmount"})
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(ProcessingRequest.class)
@CustomValidator
public abstract class AbstractProcessingRequest extends UnoComponent<unibill.model.AccountTransaction> {
 
    @FormParam("id")
    @LongFormat
    @DefaultValue(LONG_NULL_CODE)
    protected Long id;
 
    @FormParam("holderName")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String holderName;
 
    @FormParam("accountData")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String accountData;
 
    @FormParam("accountNumber")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String accountNumber;
 
    @FormParam("accountAccessory")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String accountAccessory;
 
    @FormParam("token")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String token;
 
    @FormParam("csc")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String csc;
 
    @FormParam("street")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String street;
 
    @FormParam("city")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String city;
 
    @FormParam("state")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String state;
 
    @FormParam("zipCode")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String zipCode;
 
    @FormParam("countryCode")
    @StringFormat
    protected String countryCode;
 
    @FormParam("phone")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String phone;
 
    @FormParam("email")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String email;
 
    @FormParam("dueDate")
    @DateFormat
    @DefaultValue(DATE_NULL_CODE)
    protected Date dueDate;
 
    @FormParam("type")
    @StringFormat
    protected String type;
 
    @FormParam("accountType")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String accountType;
 
    @FormParam("creatorCode")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String creatorCode;
 
    @FormParam("amount")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer amount;
 
    @FormParam("note")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String note;
 
    @FormParam("accountId")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer accountId;
 
    @FormParam("code")
    @StringFormat
    @DefaultValue(STRING_NULL_CODE)
    protected String code;
 
    @FormParam("feeAmount")
    @IntegerFormat
    @DefaultValue(INTEGER_NULL_CODE)
    protected Integer feeAmount;
 
 
    public AbstractProcessingRequest(){
        super();
        applyDefaults();
    }
 
    public AbstractProcessingRequest(unibill.model.AccountTransaction object){
        super(object);
    }
 
 
    private void applyDefaults() {
        if (!isProxyObject()) {
            id = LONG_NULL;
            holderName = STRING_NULL;
            accountData = STRING_NULL;
            accountNumber = STRING_NULL;
            accountAccessory = STRING_NULL;
            token = STRING_NULL;
            csc = STRING_NULL;
            street = STRING_NULL;
            city = STRING_NULL;
            state = STRING_NULL;
            zipCode = STRING_NULL;
            phone = STRING_NULL;
            email = STRING_NULL;
            dueDate = DATE_NULL;
            accountType = STRING_NULL;
            creatorCode = STRING_NULL;
            amount = INTEGER_NULL;
            note = STRING_NULL;
            accountId = INTEGER_NULL;
            code = STRING_NULL;
            feeAmount = INTEGER_NULL;
        }
        countryCode = "US";
        type = AP;
    }
 
    @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("processing-request: {");
        sb.append("id: ");
        sb.append(id);
        sb.append(',').append(' ');
        sb.append("holderName: ");
        sb.append(holderName);
        sb.append(',').append(' ');
        sb.append("accountData: ");
        sb.append(accountData);
        sb.append(',').append(' ');
        sb.append("accountNumber: ");
        sb.append(accountNumber);
        sb.append(',').append(' ');
        sb.append("accountAccessory: ");
        sb.append(accountAccessory);
        sb.append(',').append(' ');
        sb.append("token: ");
        sb.append(token);
        sb.append(',').append(' ');
        sb.append("csc: ");
        sb.append(csc);
        sb.append(',').append(' ');
        sb.append("street: ");
        sb.append(street);
        sb.append(',').append(' ');
        sb.append("city: ");
        sb.append(city);
        sb.append(',').append(' ');
        sb.append("state: ");
        sb.append(state);
        sb.append(',').append(' ');
        sb.append("zipCode: ");
        sb.append(zipCode);
        sb.append(',').append(' ');
        sb.append("countryCode: ");
        sb.append(countryCode);
        sb.append(',').append(' ');
        sb.append("phone: ");
        sb.append(phone);
        sb.append(',').append(' ');
        sb.append("email: ");
        sb.append(email);
        sb.append(',').append(' ');
        sb.append("dueDate: ");
        sb.append(dueDate);
        sb.append(',').append(' ');
        sb.append("type: ");
        sb.append(type);
        sb.append(',').append(' ');
        sb.append("accountType: ");
        sb.append(accountType);
        sb.append(',').append(' ');
        sb.append("creatorCode: ");
        sb.append(creatorCode);
        sb.append(',').append(' ');
        sb.append("amount: ");
        sb.append(amount);
        sb.append(',').append(' ');
        sb.append("note: ");
        sb.append(note);
        sb.append(',').append(' ');
        sb.append("accountId: ");
        sb.append(accountId);
        sb.append(',').append(' ');
        sb.append("code: ");
        sb.append(code);
        sb.append(',').append(' ');
        sb.append("feeAmount: ");
        sb.append(feeAmount);
        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;
    }
 
 
    @XmlAttribute(name="holderName")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("holderName")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 150)
    @Pattern(regexp = unipay.validator.PatternName.NAME)
    @SensitiveDataValidator
    public String getHolderName(){
        return holderName;
    }
 
    public void setHolderName(String value){
        this.holderName = value;
    }
 
    @XmlAttribute(name="accountData")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("accountData")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    public String getAccountData(){
        return accountData;
    }
 
    public void setAccountData(String value){
        this.accountData = value;
    }
 
    @XmlAttribute(name="accountNumber")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("accountNumber")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 50)
    public String getAccountNumber(){
        return accountNumber;
    }
 
    public void setAccountNumber(String value){
        this.accountNumber = value;
    }
 
    @XmlAttribute(name="accountAccessory")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("accountAccessory")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 17)
    @Pattern(regexp = unipay.validator.PatternName.NUMERIC)
    public String getAccountAccessory(){
        return accountAccessory;
    }
 
    public void setAccountAccessory(String value){
        this.accountAccessory = value;
    }
 
    @XmlAttribute(name="token")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("token")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 40)
    @Pattern(regexp = unipay.validator.PatternName.TOKEN)
    public String getToken(){
        return token;
    }
 
    public void setToken(String value){
        this.token = value;
    }
 
    @XmlAttribute(name="csc")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("csc")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 4)
    @Pattern(regexp = unipay.validator.PatternName.NUMERIC)
    public String getCsc(){
        return csc;
    }
 
    public void setCsc(String value){
        this.csc = value;
    }
 
    @XmlAttribute(name="street")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("street")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 128)
    @Pattern(regexp = unipay.validator.PatternName.STREET)
    public String getStreet(){
        return street;
    }
 
    public void setStreet(String value){
        this.street = value;
    }
 
    @XmlAttribute(name="city")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("city")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 50)
    @Pattern(regexp = unipay.validator.PatternName.ALPHANUMERIC_EXTENDED)
    public String getCity(){
        return city;
    }
 
    public void setCity(String value){
        this.city = value;
    }
 
    @XmlAttribute(name="state")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("state")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 3)
    public String getState(){
        return state;
    }
 
    public void setState(String value){
        this.state = value;
    }
 
    @XmlAttribute(name="zipCode")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("zipCode")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 10)
    public String getZipCode(){
        return zipCode;
    }
 
    public void setZipCode(String value){
        this.zipCode = value;
    }
 
    @XmlAttribute(name="countryCode")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("countryCode")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 2)
    @Pattern(regexp = unipay.validator.PatternName.ALPHA)
    public String getCountryCode(){
        return countryCode;
    }
 
    public void setCountryCode(String value){
        this.countryCode = value;
    }
 
    @XmlAttribute(name="phone")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("phone")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 15)
    @Pattern(regexp = unipay.validator.PatternName.NUMERIC)
    public String getPhone(){
        return phone;
    }
 
    public void setPhone(String value){
        this.phone = value;
    }
 
    @XmlAttribute(name="email")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("email")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 100)
    @Pattern(regexp = unipay.validator.PatternName.EMAIL)
    public String getEmail(){
        return email;
    }
 
    public void setEmail(String value){
        this.email = value;
    }
 
    @XmlAttribute(name="dueDate")
    @FormParam("dueDate")
    @DateFormat
    @JsonDeserialize(using=api.util.DateDeserializer.class)
    public Date getDueDate(){
        return dueDate;
    }
 
    public void setDueDate(Date value){
        this.dueDate = value;
    }
 
    @XmlAttribute(name="type")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("type")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 2)
    @EnumValidator(unibill.model.AccountActivityClassifier.class)
    public String getType(){
        return type;
    }
 
    public void setType(String value){
        this.type = value;
    }
 
    @XmlAttribute(name="accountType")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("accountType")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 2)
    @EnumValidator(unibill.model.AssetTransactionClassifier.class)
    public String getAccountType(){
        return accountType;
    }
 
    public void setAccountType(String value){
        this.accountType = value;
    }
 
    @XmlAttribute(name="creatorCode")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("creatorCode")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 60)
    @Pattern(regexp = unipay.validator.PatternName.CODE)
    public String getCreatorCode(){
        return creatorCode;
    }
 
    public void setCreatorCode(String value){
        this.creatorCode = value;
    }
 
    @XmlAttribute(name="amount")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("amount")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @NotNull
    @Min(1)
    public Integer getAmount(){
        return amount;
    }
 
    public void setAmount(Integer value){
        this.amount = value;
    }
 
    @XmlAttribute(name="note")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("note")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 255)
    @Pattern(regexp = unipay.validator.PatternName.TEXT)
    public String getNote(){
        return note;
    }
 
    public void setNote(String value){
        this.note = value;
    }
 
    @XmlAttribute(name="accountId")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("accountId")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    public Integer getAccountId(){
        return accountId;
    }
 
    public void setAccountId(Integer value){
        this.accountId = value;
    }
 
    @XmlAttribute(name="code")
    @XmlJavaTypeAdapter(value=api.util.StringAdapter.class, type=String.class)
    @FormParam("code")
    @StringFormat
    @JsonDeserialize(using = api.util.StringDeserializer.class)
    @Size(max = 60)
    @Pattern(regexp = unipay.validator.PatternName.CODE)
    public String getCode(){
        return code;
    }
 
    public void setCode(String value){
        this.code = value;
    }
 
    @XmlAttribute(name="feeAmount")
    @XmlJavaTypeAdapter(value=api.util.IntegerAdapter.class, type=Integer.class)
    @FormParam("feeAmount")
    @IntegerFormat
    @JsonDeserialize(using=api.util.NumberDeserializer.class)
    @Min(0)
    public Integer getFeeAmount(){
        return feeAmount;
    }
 
    public void setFeeAmount(Integer value){
        this.feeAmount = value;
    }
 
 
 
}