package com.cm.common.pojo.dtos;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * @ClassName: ZTreeDTO
 * @Description: zTree菜单
 * @Author: wenc
 * @Date: 2018/12/29 12:13 AM
 * @Version: 1.0
 **/
@ApiModel
public class ZTreeDTO implements Cloneable, Serializable {

    private static final long serialVersionUID = 1972916766961693525L;
    @ApiModelProperty(name = "id", value = "ID")
    private String id;
    @ApiModelProperty(name = "pId", value = "父ID")
    private String pId;
    @ApiModelProperty(name = "name", value = "节点名称")
    private String name;
    @ApiModelProperty(name = "url", value = "节点链接")
    private String url;
    @ApiModelProperty(name = "icon", value = "节点图标")
    private String icon;
    @ApiModelProperty(name = "target", value = "节点点击目标")
    private String target;
    @ApiModelProperty(name = "isParent", value = "是否父节点")
    private Boolean isParent;
    @ApiModelProperty(name = "checked", value = "是否勾选")
    private Boolean checked;
    @ApiModelProperty(name = "title", value = "标题")
    private String title;

    public String getId() {
        return id == null ? "" : id.trim();
    }

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

    public String getpId() {
        return pId == null ? "" : pId.trim();
    }

    public void setpId(String pId) {
        this.pId = pId;
    }

    public String getName() {
        return name == null ? "" : name.trim();
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url == null ? "" : url.trim();
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getIcon() {
        return icon == null ? "" : icon.trim();
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getTarget() {
        return target == null ? "" : target.trim();
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public Boolean getIsParent() {
        return isParent;
    }

    public void setIsParent(Boolean parent) {
        isParent = parent;
    }

    public Boolean getChecked() {
        return checked;
    }

    public void setChecked(Boolean checked) {
        this.checked = checked;
    }

    public String getTitle() {
        return title == null ? "" : title;
    }

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

    @Override
    public Object clone() {
        ZTreeDTO zTreeDTO = null;
        try{
            zTreeDTO = (ZTreeDTO) super.clone();
        }catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return zTreeDTO;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"id\":\"")
                .append(id).append('\"');
        sb.append(",\"pId\":\"")
                .append(pId).append('\"');
        sb.append(",\"name\":\"")
                .append(name).append('\"');
        sb.append(",\"url\":\"")
                .append(url).append('\"');
        sb.append(",\"icon\":\"")
                .append(icon).append('\"');
        sb.append(",\"target\":\"")
                .append(target).append('\"');
        sb.append(",\"isParent\":")
                .append(isParent);
        sb.append(",\"checked\":")
                .append(checked);
        sb.append(",\"title\":\"")
                .append(title).append('\"');
        sb.append('}');
        return sb.toString();
    }
}
