package net.northking.cctp.element.internal;


import net.northking.cctp.element.core.AbstractLibrary;
import net.northking.cctp.element.core.annotation.Autowired;
import net.northking.cctp.element.core.annotation.Library;
import net.northking.cctp.element.core.type.LibraryConstant;
import net.northking.cctp.element.internal.protocol.http.HttpClient;
import net.northking.cctp.element.util.Javadoc2Libdoc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * <p>智能接口组件库。</p>
 * 处理接口信息组装、发送及响应处理等功能。
 */
@Library(scanBasePackage = "net.northking.cctp.element.internal", infoClass = InterfaceLibrary.class)
public class InterfaceLibrary extends AbstractLibrary {

    private static final String NAME = "NK.Interface";
    private static final String CH_NAME = "智能接口组件库";
    private static final String VERSION = "3.1.12";
    private static final Logger logger = LoggerFactory.getLogger(InterfaceLibrary.class);
    private static final Javadoc2Libdoc JAVA_DOC_2_LIB_DOC = new Javadoc2Libdoc(InterfaceLibrary.class);
    private static final Integer TYPE = LibraryConstant.LIB_TYPE_INTERFACE;

    @Autowired
    protected HttpClient client;

    @Override
    public String getName() {
        return NAME;
    }

    @Override
    public String getChName() {
        return CH_NAME;
    }

    /**
     * 库当前版本
     *
     * @return
     */
    @Override
    public String getVersion() {
        return VERSION;
    }


    @Override
    public Javadoc2Libdoc getLibDoc() {
        return JAVA_DOC_2_LIB_DOC;
    }

    /**
     * 组件库类别
     *
     * @return
     */
    @Override
    public Integer getType() {
        return TYPE;
    }

    @Override
    public void destroy() {
        logger.debug("库实例销毁.");
        client.close();
    }

}