package de._125m125.kt.ktapi_java.core.objects;

import de._125m125.kt.ktapi_java.core.BUY_SELL;

public class Trade {
    private long    id;
    private boolean buySell;
    private String  materialId;
    private String  materialName;
    private int     amount;
    private double  price;
    private int     sold;
    private double  toTakeM;
    private int     toTakeI;
    private boolean cancelled;

    public Trade() {
        super();
    }

    public Trade(final long id, final boolean buySell, final String materialId, final String materialName,
            final int amount, final double price, final int sold, final double toTakeM, final int toTakeI,
            final boolean cancelled) {
        super();
        this.id = id;
        this.buySell = buySell;
        this.materialId = materialId;
        this.materialName = materialName;
        this.amount = amount;
        this.price = price;
        this.sold = sold;
        this.toTakeM = toTakeM;
        this.toTakeI = toTakeI;
        this.cancelled = cancelled;
    }

    public long getId() {
        return this.id;
    }

    public BUY_SELL getBuySell() {
        return this.buySell ? BUY_SELL.BUY : BUY_SELL.SELL;
    }

    public boolean isBuySell() {
        return this.buySell;
    }

    public boolean isBuy() {
        return this.buySell;
    }

    public boolean isSell() {
        return !this.buySell;
    }

    public String getMaterialId() {
        return this.materialId;
    }

    public String getMaterialName() {
        return this.materialName;
    }

    public int getAmount() {
        return this.amount;
    }

    public double getPrice() {
        return this.price;
    }

    public int getSold() {
        return this.sold;
    }

    public double getToTakeMoney() {
        return this.toTakeM;
    }

    public int getToTakeItems() {
        return this.toTakeI;
    }

    public boolean isCancelled() {
        return this.cancelled;
    }

    @Override
    public String toString() {
        final StringBuilder builder = new StringBuilder();
        builder.append("Trade [id=");
        builder.append(this.id);
        builder.append(", buySell=");
        builder.append(this.buySell);
        builder.append(", materialId=");
        builder.append(this.materialId);
        builder.append(", materialName=");
        builder.append(this.materialName);
        builder.append(", amount=");
        builder.append(this.amount);
        builder.append(", price=");
        builder.append(this.price);
        builder.append(", sold=");
        builder.append(this.sold);
        builder.append(", toTakeM=");
        builder.append(this.toTakeM);
        builder.append(", toTakeI=");
        builder.append(this.toTakeI);
        builder.append(", cancelled=");
        builder.append(this.cancelled);
        builder.append("]");
        return builder.toString();
    }

}

@@ -155,30 +155,26 @@
  boolean buy
-Sell
 ;%0A
+
     private 
@@ -751,20 +751,16 @@
 this.buy
-Sell
  = buySe
@@ -1149,20 +1149,16 @@
 this.buy
-Sell
  ? BUY_S
@@ -1237,36 +1237,32 @@
  return this.buy
-Sell
 ;%0A    %7D%0A%0A    pub
@@ -1298,36 +1298,32 @@
  return this.buy
-Sell
 ;%0A    %7D%0A%0A    pub
@@ -1369,20 +1369,16 @@
 this.buy
-Sell
 ;%0A    %7D%0A
@@ -2146,24 +2146,24 @@
 buySell=%22);%0A
+
         buil
@@ -2181,20 +2181,16 @@
 this.buy
-Sell
 );%0A     

fix parsing of buy for Trades