package net.northking.cctp.element.core.keyword;

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

import net.northking.cctp.element.validation.Constraint;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * Keyword component information
 *
 * @author fengxiang.zhang
 * @since 1.0
 */
public class KeywordInfo implements Serializable {

    private static final long serialVersionUID = -6979409454695965927L;

    /**
     * Keyword method name
     */
    private String keywordName;

    /**
     * Keyword alias
     */
    private String keywordAlias;

    /**
     * Keyword arguments
     */
    private List<KeywordArgument> keywordArguments;

    /**
     * Keyword return
     */
    private KeywordReturn keywordReturn;

    /**
     * Keyword documentation
     */
    private String keywordDocumentation;

    /**
     * deprecated
     */
    private boolean deprecated = false;

    /**
     * require web page hidden
     */
    private boolean hidden = false;

    /**
     * Keyword category
     */
    private String category;

    /**
     * Keyword attributes
     */
    private String attributes;

    private boolean commonlyUse =false;

    public String getKeywordAlias() {
        return keywordAlias;
    }

    public void setKeywordAlias(String keywordAlias) {
        Constraint.hasText(keywordAlias, String.format("组件:[%s], 非法的别名:[%s]", keywordName, keywordAlias));
        this.keywordAlias = keywordAlias;
    }

    public String getKeywordName() {
        return keywordName;
    }

    public void setKeywordName(String keywordName) {
        Constraint.hasText(keywordName, String.format("非法的组件名:[%s]", keywordName));
        this.keywordName = keywordName;
    }

    public List<KeywordArgument> getKeywordArguments() {
        return keywordArguments;
    }

    public void setKeywordArguments(List<KeywordArgument> keywordArguments) {
        this.keywordArguments = keywordArguments;
    }

    public KeywordReturn getKeywordReturn() {
        return keywordReturn;
    }

    public void setKeywordReturn(KeywordReturn keywordReturn) {
        this.keywordReturn = keywordReturn;
    }

    public String getKeywordDocumentation() {
        return keywordDocumentation;
    }

    public void setKeywordDocumentation(String keywordDocumentation) {
        Constraint.hasText(keywordDocumentation, String.format("组件:[%s], 请撰写注释说明", keywordName));
        this.keywordDocumentation = keywordDocumentation;
    }

    public boolean isDeprecated() {
        return deprecated;
    }

    public void setDeprecated(boolean deprecated) {
        this.deprecated = deprecated;
    }

    public boolean isHidden() {
        return hidden;
    }

    public void setHidden(boolean hidden) {
        this.hidden = hidden;
    }

    public String getCategory() {
        return category;
    }

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

    public String getAttributes() {
        return attributes;
    }

    public void setAttributes(String attributes) {
        this.attributes = attributes;
    }

    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

    public boolean isCommonlyUse() {
        return commonlyUse;
    }

    public void setCommonlyUse(boolean commonlyUse) {
        this.commonlyUse = commonlyUse;
    }
}