/**
 *
 */
package kr.co.kihyun.beans.entity;

import java.util.ArrayList;
import java.util.List;

import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;

/**
 * @author bhs
 *
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Category extends StringEntity {

	/**
	 *
	 */
	private static final long serialVersionUID = -8086309544883386757L;

	public static final String ID_TOT_DOC_COMMENT = "ID_TOT_DOC_COMMENT";
	public static final String ID_BOARD = "ID_BOARD";
	public static final String ID_SYSTEM_NOTICE = "ID_SYSTEM_NOTICE";
	public static final String ID_FAQ = "ID_FAQ";
	//public static final String ID_QNA = "ID_QNA";
	public static final String ID_PDS = "ID_PDS";

	@Persistent
	private String name;

	@Persistent
	private Category upperCategory;

	@Persistent
	private int priority;

	@Persistent(mappedBy = "upperCategory")
	private List<Category> childCategories = new ArrayList<Category>();

	public Category() {
	}

	public Category(String id) {
		this.setId(id);
	}

	public Category(String id, String name) {
		this.setId(id);
		this.setName(name);
	}

	public Category(String id, String name, Category upperCategory) {
		this.setId(id);
		this.setName(name);
		this.setUpperCategory(upperCategory);
	}

	public Category(String id, String name, Category upperCategory, int priority) {
		this.setId(id);
		this.setName(name);
		this.setUpperCategory(upperCategory);
		this.setPriority(priority);
	}

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

	public String getName() {
		return name;
	}

	public void setUpperCategory(Category upperCategory) {
		this.upperCategory = upperCategory;
	}

	public Category getUpperCategory() {
		return upperCategory;
	}

	public void setChildCategories(List<Category> childCategories) {
		this.childCategories = childCategories;
	}

	public List<Category> getChildCategories() {
		return childCategories;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	public int getPriority() {
		return priority;
	}
}
