package com.hw.nativeapp.httpnet.entity;

import java.util.List;

/**
 * Created by kaka on 2018/3/19.
 * email:375120706@qq.com
 */

public class ResponseData<E> {

    private int code;

    private String msg;

    private E data;

    private List<E> list;

    private PageData page;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

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

    public E getData() {
        return data;
    }

    public void setData(E data) {
        this.data = data;
    }

    public PageData getPage() {
        return page;
    }

    public void setPage(PageData page) {
        this.page = page;
    }

    public static class  PageData{

        /**
         * totalRows : 2
         * curPage : 1
         * pageSize : 15
         * startIndex : 0
         * endIndex : 15
         * totalPages : 1
         */

        private int totalRows;
        private int curPage;
        private int pageSize;
        private int startIndex;
        private int endIndex;
        private int totalPages;

        public int getTotalRows() {
            return totalRows;
        }

        public void setTotalRows(int totalRows) {
            this.totalRows = totalRows;
        }

        public int getCurPage() {
            return curPage;
        }

        public void setCurPage(int curPage) {
            this.curPage = curPage;
        }

        public int getPageSize() {
            return pageSize;
        }

        public void setPageSize(int pageSize) {
            this.pageSize = pageSize;
        }

        public int getStartIndex() {
            return startIndex;
        }

        public void setStartIndex(int startIndex) {
            this.startIndex = startIndex;
        }

        public int getEndIndex() {
            return endIndex;
        }

        public void setEndIndex(int endIndex) {
            this.endIndex = endIndex;
        }

        public int getTotalPages() {
            return totalPages;
        }

        public void setTotalPages(int totalPages) {
            this.totalPages = totalPages;
        }

        @Override
        public String toString() {
            return "PageData{" +
                    "totalRows=" + totalRows +
                    ", curPage=" + curPage +
                    ", pageSize=" + pageSize +
                    ", startIndex=" + startIndex +
                    ", endIndex=" + endIndex +
                    ", totalPages=" + totalPages +
                    '}';
        }
    }

    public List<E> getList() {
        return list;
    }

    public void setList(List<E> list) {
        this.list = list;
    }

    @Override
    public String toString() {
        return "ResponseData{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                ", page=" + page +
                '}';
    }

}
