package com.xeiam.xchange.poloniex.dto.trade;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Generated;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.xeiam.xchange.poloniex.dto.marketdata.PoloniexPublicTrade;

@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("org.jsonschema2pojo")
@JsonPropertyOrder({ "orderNumber", "resultingTrades" })
public class PoloniexTradeResponse {

  @JsonProperty("orderNumber")
  private Integer orderNumber;
  @JsonProperty("resultingTrades")
  private List<PoloniexPublicTrade> resultingTrades = new ArrayList<PoloniexPublicTrade>();
  @JsonIgnore
  private Map<String, Object> additionalProperties = new HashMap<String, Object>();

  @JsonProperty("orderNumber")
  public Integer getOrderNumber() {

    return orderNumber;
  }

  @JsonProperty("orderNumber")
  public void setOrderNumber(Integer orderNumber) {

    this.orderNumber = orderNumber;
  }

  @JsonProperty("resultingTrades")
  public List<PoloniexPublicTrade> getPoloniexPublicTrades() {

    return resultingTrades;
  }

  @JsonProperty("resultingTrades")
  public void setPoloniexPublicTrades(List<PoloniexPublicTrade> resultingTrades) {

    this.resultingTrades = resultingTrades;
  }

  @JsonAnyGetter
  public Map<String, Object> getAdditionalProperties() {

    return this.additionalProperties;
  }

  @JsonAnySetter
  public void setAdditionalProperty(String name, Object value) {

    this.additionalProperties.put(name, value);
  }

}

@@ -72,34 +72,8 @@
 st;%0A
-import java.util.HashMap;%0A
 impo
@@ -95,334 +95,117 @@
 st;%0A
+%0A
 import 
-java.util.Map;%0A%0Aimport javax.annotation.Generated;%0A%0Aimport com.fasterxml.jackson.annotation.JsonAnyGetter;%0Aimport com.fasterxml.jackson.annotation.JsonAnySetter;%0Aimport com.fasterxml.jackson.annotation.JsonIgnore;%0Aimport com.fasterxml.jackson.annotation.JsonInclude;%0Aimport com.fasterxml.jackson.annotation.JsonProperty
+si.mazi.rescu.ExceptionalReturnContentException;%0A%0Aimport com.fasterxml.jackson.annotation.JsonCreator
 ;%0Aim
@@ -254,21 +254,16 @@
 Property
-Order
 ;%0Aimport
@@ -331,286 +331,98 @@
 e;%0A%0A
-@JsonInclude(JsonInclude.Include.NON_NULL)%0A@Generated(%22org.jsonschema2pojo%22)%0A@JsonPropertyOrder(%7B %22orderNumber%22, %22resultingTrades%22 %7D)%0Apublic class PoloniexTradeResponse %7B%0A%0A  @JsonProperty(%22orderNumber%22)%0A  private Integer orderNumber;%0A  @JsonProperty(%22resultingTrades%22)%0A  private
+public class PoloniexTradeResponse %7B%0A%0A  private final Integer orderNumber;%0A  private final
  Lis
@@ -504,264 +504,91 @@
 ();%0A
+%0A
   @Json
-Ignore%0A  private Map%3CString, Object%3E additionalProperties = new HashMap%3CString, Object%3E();%0A%0A  @JsonProperty(%22orderNumber%22)%0A  public Integer getOrderNumber() %7B%0A%0A    return orderNumber;%0A  %7D%0A%0A  @JsonProperty(%22orderNumber%22)%0A  public void setOrderNumber(
+Creator%0A  public PoloniexTradeResponse(%0A      @JsonProperty(%22orderNumber%22) 
 Inte
@@ -606,54 +606,14 @@
 mber
-) %7B%0A
+,
 %0A    
-this.orderNumber = orderNumber;%0A  %7D%0A%0A
   @J
@@ -642,25 +642,16 @@
 Trades%22)
-%0A  public
  List%3CPo
@@ -673,32 +673,23 @@
 de%3E 
-getPoloniexPublic
+resulting
 Trades
-(
 ) %7B%0A
@@ -697,136 +697,165 @@
     
-return resultingTrades;%0A  %7D%0A%0A  @JsonProperty(%22resultingTrades
+if (orderNumber == null) %7B%0A      throw new ExceptionalReturnContentException(%22No trade data in response
 %22)
+;
 %0A  
-public void setPoloniexPublicTrades(List%3CPoloniexPublicTrade%3E 
+  %7D%0A    this.orderNumber = orderNumber;%0A    if (
 resu
@@ -861,29 +861,38 @@
 ultingTrades
+ != null
 ) %7B%0A
-%0A
+  
     this.res
@@ -903,19 +903,24 @@
 ngTrades
- = 
+.addAll(
 resultin
@@ -930,262 +930,178 @@
 ades
+)
 ;%0A
+  
   %7D%0A
-%0A
   
-@JsonAnyGetter%0A  public Map%3CString, Object%3E getAdditionalProperties() %7B%0A%0A    return this.additionalProperties;%0A  %7D%0A%0A  @JsonAnySetter%0A  public void setAdditionalProperty(String name, Object value) %7B%0A%0A    this.additionalProperties.put(name, value)
+%7D%0A%0A  public Integer getOrderNumber() %7B%0A%0A    return orderNumber;%0A  %7D%0A%0A  public List%3CPoloniexPublicTrade%3E getPoloniexPublicTrades() %7B%0A%0A    return resultingTrades
 ;%0A  

use @JsonCreator v. getter/setter to throw http-2xx API errors