package com.hippo.ehviewer.dao;

import org.greenrobot.greendao.annotation.*;
import com.alibaba.fastjson.JSONObject;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit. 
/**
 * Entity mapped to table "QUICK_SEARCH".
 */
@Entity(nameInDb = "QUICK_SEARCH")
public class QuickSearch {

	@Id
	public Long id;
	public String name;
	public int mode;
	public int category;
	public String keyword;
	public int advanceSearch;
	public int minRating;
	public int pageFrom;
	public int pageTo;
	public long time;

	@Generated
	public QuickSearch() {
	}

	public QuickSearch(Long id) {
		this.id = id;
	}

	@Generated
	public QuickSearch(Long id, String name, int mode, int category, String keyword, int advanceSearch, int minRating,
			int pageFrom, int pageTo, long time) {
		this.id = id;
		this.name = name;
		this.mode = mode;
		this.category = category;
		this.keyword = keyword;
		this.advanceSearch = advanceSearch;
		this.minRating = minRating;
		this.pageFrom = pageFrom;
		this.pageTo = pageTo;
		this.time = time;
	}

	public Long getId() {
		return id;
	}

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

	public String getName() {
		return name;
	}

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

	public int getMode() {
		return mode;
	}

	public void setMode(int mode) {
		this.mode = mode;
	}

	public int getCategory() {
		return category;
	}

	public void setCategory(int category) {
		this.category = category;
	}

	public String getKeyword() {
		return keyword;
	}

	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	public int getAdvanceSearch() {
		return advanceSearch;
	}

	public void setAdvanceSearch(int advanceSearch) {
		this.advanceSearch = advanceSearch;
	}

	public int getMinRating() {
		return minRating;
	}

	public void setMinRating(int minRating) {
		this.minRating = minRating;
	}

	public int getPageFrom() {
		return pageFrom;
	}

	public void setPageFrom(int pageFrom) {
		this.pageFrom = pageFrom;
	}

	public int getPageTo() {
		return pageTo;
	}

	public void setPageTo(int pageTo) {
		this.pageTo = pageTo;
	}

	public long getTime() {
		return time;
	}

	public void setTime(long time) {
		this.time = time;
	}

	@Override
	public String toString() {
		return name;
	}

	public JSONObject toJson() {
		JSONObject object = new JSONObject();
		object.put("name", name);
		object.put("mode", mode);
		object.put("category", category);
		object.put("keyword", keyword);
		object.put("advanceSearch", advanceSearch);
		object.put("minRating", minRating);
		object.put("pageFrom", pageFrom);
		object.put("pageTo", pageTo);
		object.put("time", time);
		return object;
	}

	public static QuickSearch quickSearchFromJson(JSONObject object) {
		QuickSearch search = new QuickSearch();
		search.name = object.getString("name");
		search.mode = object.getIntValue("mode");
		search.category = object.getIntValue("category");
		search.keyword = object.getString("keyword");
		search.advanceSearch = object.getIntValue("advanceSearch");
		search.minRating = object.getIntValue("minRating");
		search.pageFrom = object.getIntValue("pageFrom");
		search.pageTo = object.getIntValue("pageTo");
		search.time = object.getLongValue("time");
		return search;
	}

}
