/*
 * (c) Copyright 2016 FFB Depot Client Developers.
 *
 * This file is part of FFB Depot Client.
 *
 * FFB Depot Client is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * FFB Depot Client is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with FFB Depot Client.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

package de.bmarwell.ffb.depot.client.json;

import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;

import java.util.ArrayList;
import java.util.List;

public class FfbUmsatzResponse {
  private boolean login;
  private int dispositionenAnzahl;
  private String dispositionenBetrag;
  private List<FfbDisposition> dispositionen = new ArrayList<>();
  private String errormessage;

  public boolean isLogin() {
    return login;
  }

  public int getDispositionenAnzahl() {
    return dispositionenAnzahl;
  }

  public double getDispositionenBetrag() {
    return Double.parseDouble(dispositionenBetrag.replace(".", "").replace(',', '.'));
  }

  public List<FfbDisposition> getDispositionen() {
    return ImmutableList.<FfbDisposition>copyOf(dispositionen);
  }

  public String getErrormessage() {
    return errormessage;
  }

  @Override
  public String toString() {
    return MoreObjects.toStringHelper(this)
        .add("login", login)
        .add("dispositionenAnzahl", getDispositionenAnzahl())
        .add("dispositionenBetrag", getDispositionenBetrag())
        .add("dispositionen", getDispositionen())
        .add("errormessage", getErrormessage())
        .toString();
  }

}

@@ -816,44 +816,53 @@
 ort 
-com.google.common.base.MoreObject
+de.bmarwell.ffb.depot.client.FfbDepotUtil
 s;%0A
+%0A
 impo
@@ -879,67 +879,111 @@
 gle.
-common.collect.ImmutableList;%0A%0Aimport java.util.ArrayList
+gson.annotations.SerializedName;%0A%0Aimport org.immutables.gson.Gson;%0Aimport org.immutables.value.Value
 ;%0A
+%0A
 impo
@@ -1002,22 +1002,67 @@
 .List;%0A%0A
-public
+@Value.Immutable%0A@Gson.TypeAdapters%0Apublic abstract
  class F
@@ -1084,85 +1084,64 @@
 e %7B%0A
+%0A
   
-private boolean 
+@SerializedName(%22
 login
-;
+%22)
 %0A  pr
-ivate int dispositionenAnzahl;%0A  private
+otected abstract
  String 
 disp
@@ -1140,420 +1140,323 @@
 ing 
-d
 is
-positionenBetrag;%0A  private List%3CFfbDisposition%3E dispositionen = new ArrayList%3C%3E();%0A  private String errormessage;%0A%0A  public boolean isLogin() %7B%0A    return login;%0A  %7D%0A%0A  public int getDispositionenAnzahl() %7B%0A    return dispositionenAnzahl;%0A  %7D%0A%0A  public double getDispositionenBetrag() %7B%0A    return Double.parseDouble(dispositionenBetrag.replace(%22.%22, %22%22).replace(',', '.'));%0A  %7D%0A%0A  public List%3CFfbDisposition%3E
+LoginAsString();%0A%0A  public boolean isLogin() %7B%0A    return Boolean.parseBoolean(isLoginAsString());%0A  %7D%0A%0A  @SerializedName(%22dispositionenAnzahl%22)%0A  public abstract int getDispositionenAnzahl();%0A%0A  @SerializedName(%22dispositionenBetrag%22)%0A  protected abstract String getDispositionenBetragAsString();%0A%0A  public double
  get
@@ -1468,16 +1468,22 @@
 sitionen
+Betrag
 () %7B%0A   
@@ -1494,385 +1494,117 @@
 urn 
-ImmutableList.%3CFfbDisposition%3EcopyOf(dispositionen);%0A  %7D%0A%0A  public String getErrormessage() %7B%0A    return errormessage;%0A  %7D%0A%0A  @Override%0A  public String toString() %7B%0A    return MoreObjects.toStringHelper(this)%0A        .add(%22login%22, login)%0A        .add(%22dispositionenAnzahl%22, getDispositionenAnzahl
+FfbDepotUtils.convertGermanNumberToDouble(getDispositionenBetragAsString
 ())
+;
 %0A  
-      .add(%22dispositionenBetrag%22, getDispositionenBetrag())%0A        .add(%22d
+%7D%0A%0A  public abstract List%3CFfbD
 ispo
@@ -1613,12 +1613,9 @@
 tion
-en%22,
+%3E
  get
@@ -1633,82 +1633,54 @@
 en()
-)%0A        .add(%22errormessage%22, getErrormessage())%0A        .toString();%0A  %7D
+;%0A%0A  public abstract String getErrormessage();
 %0A%0A%7D%0A

Convert FfbUmsatzResponse to Immutables.