package com.uas.report.model;

import com.uas.report.util.StringUtils;

/**
 * 账套
 * 
 * @author sunyj
 * @since 2017年2月15日 下午1:57:31
 */
public class Master {

	private String name;

	private Master parent;

	public Master(String name) {
		this(name, null);
	}

	public Master(String name, Master parent) {
		if (StringUtils.isEmpty(name)) {
			throw new IllegalArgumentException("账套名称不能为空");
		}
		this.name = name;
		this.parent = parent;
	}

	public String getName() {
		return name;
	}

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

	public Master getParent() {
		return parent;
	}

	public void setParent(Master parent) {
		this.parent = parent;
	}

	public boolean hasParent() {
		return parent != null && !StringUtils.isEmpty(parent.getName());
	}

	@Override
	public String toString() {
		return "Master [name=" + name + ", parent=" + parent + "]";
	}

}
