package com.yihu.hos.crawler.model.standard;

import com.yihu.hos.crawler.format.AdapterBase;
import com.yihu.hos.crawler.model.transform.DictDataType;
import com.yihu.hos.standard.model.standard.StdMetaDataModel;
import static com.yihu.hos.crawler.model.transform.MetaDataType.S2;
import static com.yihu.hos.crawler.model.transform.MetaDataType.S3;

/**
 * @author Air
 * @version 1.0
 * @created 2015.08.11 15:25
 */
public class StdMetaData extends AdapterBase {
    private StdMetaDataModel stdMetaDataT;

    public StdMetaData(StdMetaDataModel stdMetaDataT) {
        this.stdMetaDataT = stdMetaDataT;
    }

    public StdMetaDataModel getStdMetaDataT() {
        return stdMetaDataT;
    }

    public DictDataType getDictDataType() {
        Integer dict = stdMetaDataT.getDictId();
        String type = stdMetaDataT.getType();
        int dictValueType;
        if (dict!=null && (type.equals(S2.name()) || type.equals(S3.name()))) {
            dictValueType = DictDataType.CODE.ordinal();
        } else {
            dictValueType = DictDataType.VALUE.ordinal();
        }

        return DictDataType.values()[dictValueType];
    }
}
