package com.sw.mes.fb.aio.dto;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.sw.mes.enumvalue.EnumValuesFbServer;

/**
 * @author liuzemin
 * @date 2022/6/9 10:15
 * @description
 */
public class ClosureIdentificationConverter implements Converter<String> {

    @Override
    public Class supportJavaTypeKey() {
        return null;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return null;
    }

    @Override
    public String convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return EnumValuesFbServer.ClosureIdentification.valueOf(cellData.getStringValue()).getKey();
    }

    @Override
    public CellData<String> convertToExcelData(String string, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return new CellData<>(EnumValuesFbServer.ClosureIdentification.getText(string));
    }
}
