package com.bjzc.zjdxj.bean;



import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by ruihong on 2018/4/17.
 * 设备列表
 */

public class DeviceTreeBean  implements Parcelable {

    private int state;
    private String msg;
    private List<DataBean> data;

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean  implements Parcelable{
        /**
         * 设备数据
         */
        private String ID;        // 7241,          //账号id
        private String NNAME; // "用户原因",    //原因名称
        private String PARENTID;   // 0,           //父id     0表示父节点
        private String ISLEAF;     //0,            //是否是叶子节点   1为叶子节点
        private int DISPLAY_ORDER; // 1       //同一个级别的显示顺序
        private boolean isExpand = false;  //是否展开了
        private boolean isSelected = false; //是否选中了

        public String getID() {
            return ID;
        }

        public void setID(String ID) {
            this.ID = ID;
        }

        public String getNNAME() {
            return NNAME;
        }

        public void setNNAME(String NNAME) {
            this.NNAME = NNAME;
        }

        public String getPARENTID() {
            return PARENTID;
        }

        public void setPARENTID(String PARENTID) {
            this.PARENTID = PARENTID;
        }

        public String getISLEAF() {
            return ISLEAF;
        }

        public void setISLEAF(String ISLEAF) {
            this.ISLEAF = ISLEAF;
        }

        public int getDISPLAY_ORDER() {
            return DISPLAY_ORDER;
        }

        public void setDISPLAY_ORDER(int DISPLAY_ORDER) {
            this.DISPLAY_ORDER = DISPLAY_ORDER;
        }

        public boolean isExpand() {
            return isExpand;
        }

        public void setExpand(boolean expand) {
            isExpand = expand;
        }

        public boolean isSelected() {
            return isSelected;
        }

        public void setSelected(boolean selected) {
            isSelected = selected;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.ID);
            dest.writeString(this.NNAME);
            dest.writeString(this.PARENTID);
            dest.writeString(this.ISLEAF);
            dest.writeInt(this.DISPLAY_ORDER);
            dest.writeByte((byte)(this.isExpand ?1:0));
            dest.writeByte((byte)(this.isSelected ?1:0));
        }

        public DataBean() {
        }

        protected DataBean(Parcel in) {
            this.ID = in.readString();
            this.NNAME = in.readString();
            this.PARENTID = in.readString();
            this.ISLEAF = in.readString();
            this.DISPLAY_ORDER = in.readInt();
            this.isExpand = in.readByte()!=0;
            this.isSelected = in.readByte()!=0;
        }

        public static final Creator<DataBean> CREATOR = new Creator<DataBean>() {
            @Override
            public DataBean createFromParcel(Parcel source) {
                return new DataBean(source);
            }

            @Override
            public DataBean[] newArray(int size) {
                return new DataBean[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.state);
        dest.writeString(this.msg);
        dest.writeList(this.data);
    }

    public DeviceTreeBean() {
    }

    protected DeviceTreeBean(Parcel in) {
        this.state = in.readInt();
        this.msg = in.readString();
        this.data = new ArrayList<DataBean>();
        in.readList(this.data, DataBean.class.getClassLoader());
    }

    public static final Creator<DeviceTreeBean> CREATOR = new Creator<DeviceTreeBean>() {
        @Override
        public DeviceTreeBean createFromParcel(Parcel source) {
            return new DeviceTreeBean(source);
        }

        @Override
        public DeviceTreeBean[] newArray(int size) {
            return new DeviceTreeBean[size];
        }
    };
}
