package cn.axzo.workflow.core.service.converter;

import cn.axzo.workflow.common.model.response.category.CategoryItemVO;
import cn.axzo.workflow.core.repository.entity.ExtAxDictDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.Arrays;

import static org.mapstruct.NullValueCheckStrategy.ALWAYS;

/**
 * 分类的 MapStruts 转换器
 */
@Mapper(
        componentModel = "spring",
        nullValueCheckStrategy = ALWAYS,
        imports = Arrays.class
)
public interface CategoryConverter extends EntityConverter<CategoryItemVO, ExtAxDictDO> {

    @Mapping(target = "id", source = "category.id")
    @Mapping(target = "type", source = "category.type")
    @Mapping(target = "label", source = "category.label")
    @Mapping(target = "value", source = "category.value")
    @Mapping(target = "remark", source = "category.remark")
    @Mapping(target = "status", source = "category.status")
    CategoryItemVO toVo(ExtAxDictDO category);
}
