package com.kancolle.server.model.po.useitem;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.google.common.collect.ImmutableList;
import org.apache.ibatis.type.Alias;

import java.io.Serializable;

@JsonPropertyOrder(value = {
        "member_id", "useItemId", "value", "api_usetype",
        "api_category", "api_name", "api_description", "api_price",
        "count"
})
@Alias("MemberUseItem")
public class MemberUseItem implements Serializable {

    private static final long serialVersionUID = 3773472417961605052L;

    @JsonProperty(value = "api_member_id")
    private final long member_id;

    @JsonProperty(value = "api_id")
    private final int useItemId;

    @JsonProperty(value = "api_value")
    public final int value;

    @JsonIgnore
    private final UseItem useItem;

    @JsonProperty(value = "api_description")
    private final ImmutableList<String> description = ImmutableList.of("","");

    @JsonProperty(value = "api_count")
    private int count;

    public MemberUseItem(final long member_id, final int useItemId, final int value, final UseItem useItem) {
        this.member_id = member_id;
        this.useItemId = useItemId;
        this.value = value;
        this.useItem = useItem;
    }

    public long getMember_id() {
        return member_id;
    }

    public int getValue() {
        return value;
    }

    public int getUseItemId() {
        return useItemId;
    }

    @JsonProperty(value = "api_count")
    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    @JsonProperty(value = "api_usetype")
    public int getUsetype() {
        return useItem.getUsetype();
    }

    @JsonProperty(value = "api_category")
    public int getCategory() {
        return useItem.getCategory();
    }

    @JsonProperty(value = "api_name")
    public String getName() {
        return useItem.getName();
    }

    public ImmutableList<String> getDescription() {
        return description;
    }

    @JsonProperty(value = "api_price")
    public int getPrice() {
        return useItem.getPrice();
    }

    public UseItem getUseItem() {
        return useItem;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MemberUseItem that = (MemberUseItem) o;

        if (member_id != that.member_id) return false;
        if (useItemId != that.useItemId) return false;
        if (value != that.value) return false;
        return count == that.count;

    }

    @Override
    public int hashCode() {
        int result = (int) (member_id ^ (member_id >>> 32));
        result = 31 * result + useItemId;
        result = 31 * result + value;
        result = 31 * result + count;
        return result;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("MemberUseItem{");
        sb.append("member_id=").append(member_id);
        sb.append(", useItem=").append(useItem);
        sb.append(", count=").append(count);
        sb.append('}');
        return sb.toString();
    }
}

@@ -331,16 +331,41 @@
 ble;%0D%0A%0D%0A
+@Alias(%22MemberUseItem%22)%0D%0A
 @JsonPro
@@ -482,20 +482,16 @@
 name%22, %22
-api_
 descript
@@ -535,33 +535,8 @@
 %7D)%0D%0A
-@Alias(%22MemberUseItem%22)%0D%0A
 publ
@@ -1061,16 +1061,17 @@
 t.of(%22%22,
+ 
 %22%22);%0D%0A%0D%0A
@@ -1454,32 +1454,101 @@
 r_id;%0D%0A    %7D%0D%0A%0D%0A
+    public int getUseItemId() %7B%0D%0A        return useItemId;%0D%0A    %7D%0D%0A%0D%0A
     public int g
@@ -1595,35 +1595,39 @@
 %7D%0D%0A%0D%0A    public 
-int
+UseItem
  getUseItemId() 
@@ -1613,34 +1613,32 @@
 eItem getUseItem
-Id
 () %7B%0D%0A        re
@@ -1641,34 +1641,32 @@
   return useItem
-Id
 ;%0D%0A    %7D%0D%0A%0D%0A    
@@ -1669,42 +1669,93 @@
     
-@JsonProperty(value = %22api_count%22)
+public ImmutableList%3CString%3E getDescription() %7B%0D%0A        return description;%0D%0A    %7D%0D%0A
 %0D%0A  
@@ -2251,99 +2251,8 @@
 %0D%0A%0D%0A
-    public ImmutableList%3CString%3E getDescription() %7B%0D%0A        return description;%0D%0A    %7D%0D%0A%0D%0A
     
@@ -2365,77 +2365,8 @@
 %0D%0A%0D%0A
-    public UseItem getUseItem() %7B%0D%0A        return useItem;%0D%0A    %7D%0D%0A%0D%0A
     

update member useItem