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

import cn.axzo.workflow.common.model.request.bpmn.task.AttachmentDTO;
import org.flowable.engine.task.Attachment;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.Arrays;

import static org.mapstruct.NullValueCheckStrategy.ALWAYS;

/**
 * 任务附件 MapStruts 转换器
 *
 * @author wangli
 * @since 2023/7/30 13:30
 */
@Mapper(
        componentModel = "spring",
        nullValueCheckStrategy = ALWAYS,
        imports = Arrays.class
)
public interface BpmnHistoricAttachmentConverter extends EntityConverter<AttachmentDTO, Attachment> {

    @Mapping(target = "id", source = "id")
    @Mapping(target = "type", source = "type")
    @Mapping(target = "name", source = "name")
    @Mapping(target = "description", source = "description")
    @Mapping(target = "url", source = "url")
    @Override
    AttachmentDTO toVo(Attachment entity);
}
