package com.yutou.jianr_mg.Data;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.List;
import java.util.SplittableRandom;

public class TeamData {
    private int id;
    private int jid;
    private int type;
    private int level;
    private String title;
    private String hp;
    private String hpMax;
    private String imageUrl;
    private String item1Url;
    private String item2Url;
    private String item3Url;
    private String item4Url;
    private List<String> equipments;
    private boolean user;
    private JSONObject src;
    private long createTime;

    public int getJid() {
        return jid;
    }

    public void setJid(int jid) {
        this.jid = jid;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public TeamData() {
        createTime = System.currentTimeMillis();
    }


    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"id\":")
                .append(id);
        sb.append(",\"jid\":")
                .append(jid);
        sb.append(",\"title\":\"")
                .append(title).append('\"');
        sb.append(",\"level\":")
                .append(level).append("\"");
        sb.append(",\"hp\":\"")
                .append(hp).append('\"');
        sb.append(",\"hpMax\":\"")
                .append(hpMax).append('\"');
        sb.append(",\"imageUrl\":\"")
                .append(imageUrl).append('\"');
        sb.append(",\"item1Url\":\"")
                .append(item1Url).append('\"');
        sb.append(",\"item2Url\":\"")
                .append(item2Url).append('\"');
        sb.append(",\"item3Url\":\"")
                .append(item3Url).append('\"');
        sb.append(",\"item4Url\":\"")
                .append(item4Url).append('\"');
        sb.append(",\"user\":")
                .append(user);
        sb.append(",\"src\":")
                .append(src);
        sb.append(",\"createTime\":")
                .append(createTime);
        sb.append('}');
        return sb.toString();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public long getCreateTime() {
        return createTime;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getHp() {
        return hp;
    }

    public void setHp(String hp) {
        this.hp = hp;
    }

    public String getHpMax() {
        return hpMax;
    }

    public void setHpMax(String hpMax) {
        this.hpMax = hpMax;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public String getItem1Url() {
        return item1Url;
    }

    public void setItem1Url(String item1Url) {
        this.item1Url = item1Url;
    }

    public String getItem2Url() {
        return item2Url;
    }

    public void setItem2Url(String item2Url) {
        this.item2Url = item2Url;
    }

    public String getItem3Url() {
        return item3Url;
    }

    public void setItem3Url(String item3Url) {
        this.item3Url = item3Url;
    }

    public String getItem4Url() {
        return item4Url;
    }

    public void setItem4Url(String item4Url) {
        this.item4Url = item4Url;
    }

    public boolean isUser() {
        return user;
    }

    public void setUser(boolean user) {
        this.user = user;
    }

    public List<String> getEquipments() {
        return equipments;
    }

    public void setEquipments(List<String> equipments) {
        this.equipments = equipments;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public JSONObject getSrc() {
        try {
            if (src != null)
                src.put("createTime", createTime);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return src;
    }

    public void setSrc(JSONObject src) {
        this.src = src;
    }

}
