package com.yihu.hos.web.framework.model;

import java.io.Serializable;
import java.util.List;

public class DetailModelResult extends Result implements Serializable{

	private static final long serialVersionUID = 2076324875575488461L;

	private int pageSize = 10;

	private int currPage;

	private int totalPage;

	private int totalCount;

	private List detailModelList;

	private Object obj;

	public int getPageSize() {
		return pageSize;
	}

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

	public int getCurrPage() {
		return currPage;
	}

	public void setCurrPage(int currPage) {
		this.currPage = currPage;
	}

	public int getTotalPage() {
		if (totalCount % pageSize == 0) {
			totalPage = totalCount / pageSize;
		} else {
			totalPage = totalCount / pageSize + 1;
		}
		return totalPage;
	}

	public Object getObj() {
		return obj;
	}

	public void setObj(Object obj) {
		this.obj = obj;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public int getStart() {
		if (currPage != 0) {
			return (currPage - 1) * pageSize;
		}
		return 0;
	}

	public int getEnd() {
		if (currPage != 0) {
			return currPage * pageSize;
		}
		return 0;
	}

	public static DetailModelResult success(String message) {
		DetailModelResult detailModelResult = new DetailModelResult();
		detailModelResult.setSuccessFlg(true);
		detailModelResult.setMessage(message);
		return detailModelResult;
	}

	public static DetailModelResult error(String message) {
		DetailModelResult detailModelResult = new DetailModelResult();
		detailModelResult.setSuccessFlg(false);
		detailModelResult.setMessage(message);
		return detailModelResult;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public List getDetailModelList() {
		return detailModelList;
	}

	public void setDetailModelList(List detailModelList) {
		this.detailModelList = detailModelList;
	}
}