package com.byteowls.jopencage.model;

import java.util.Collections;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonInclude(Include.NON_NULL)
public class JOpenCageResponse {
  
  private List<JOpenCageLicence> licenses;
  private JOpenCageRate rate; 
  private List<JOpenCageResult> results;
  private JOpenCageStatus status;
  
  @JsonProperty("stay_informed")
  private JOpenCageStayInformed stayInformed;
  
  private String thanks;
  private JOpenCageTimestamp timestamp;
  @JsonProperty("total_results")
  private int totalResults;
  
  public List<JOpenCageLicence> getLicenses() {
    return licenses;
  }
  
  public JOpenCageRate getRate() {
    return rate;
  }
  
  public List<JOpenCageResult> getResults() {
    return results;
  }
  
  public JOpenCageStatus getStatus() {
    return status;
  }
  
  public String getThanks() {
    return thanks;
  }
  
  public JOpenCageTimestamp getTimestamp() {
    return timestamp;
  }
  
  public int getTotalResults() {
    return totalResults;
  }
  
  public void orderResultByConfidence() {
    Collections.sort(this.results);
    Collections.reverse(this.results);
  }
  
  public JOpenCageLatLng getFirstPosition() {
    if (this.results != null) {
      orderResultByConfidence();
      for (JOpenCageResult r : this.results) {
        return r.getGeometry();
      }
    }
    return null;
  }
  
  public JOpenCageComponents getFirstComponents() {
    if (this.results != null) {
      orderResultByConfidence();
      for (JOpenCageResult r : this.results) {
        return r.getComponents();
      }
    }
    return null;
  }
  
  
}

@@ -330,24 +330,61 @@
 onse %7B%0D%0A  %0D%0A
+  private String documentation;%0D%0A  %0D%0A
   private Li
@@ -743,24 +743,96 @@
 sults;%0D%0A  %0D%0A
+  public String getDocumentation() %7B%0D%0A    return documentation;%0D%0A  %7D%0D%0A%0D%0A
   public Lis

Add "documentation" to response