package com.qmth.sop.business.templete.converter;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.WriteConverterContext;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.qmth.sop.common.enums.DingSubmitStatusEnum;

public class DingSubmitStatusEnumConverter implements Converter<DingSubmitStatusEnum> {
    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    @Override
    public WriteCellData<?> convertToExcelData(DingSubmitStatusEnum value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        return new WriteCellData<>(value.toString());
    }

    @Override
    public WriteCellData<?> convertToExcelData(WriteConverterContext<DingSubmitStatusEnum> context) {
        return new WriteCellData<>(context.getValue().toString());
    }
}
