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

import cn.axzo.workflow.common.model.response.form.model.FormModelBaseVO;
import org.flowable.engine.repository.Model;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.Arrays;

import static org.mapstruct.NullValueCheckStrategy.ALWAYS;

/**
 * 表单模型的 MapStruts 转换器
 *
 * @author wangli
 * @since 2023/7/25 13:33
 */
@Mapper(
        componentModel = "spring",
        nullValueCheckStrategy = ALWAYS,
        imports = Arrays.class
)
public interface FormModelConverter extends EntityConverter<FormModelBaseVO, Model> {
    @Mapping(target = "id", source = "entity.id")
    @Mapping(target = "name", source = "entity.name")
    @Mapping(target = "key", source = "entity.key")
    @Mapping(target = "category", source = "entity.category")
    @Mapping(target = "deploymentId", source = "entity.deploymentId")
    @Mapping(target = "tenantId", source = "entity.tenantId")
    @Mapping(target = "version", source = "entity.version")
    @Mapping(target = "createAt", source = "entity.createTime")
    @Mapping(target = "updateAt", source = "entity.lastUpdateTime")
    @Override
    FormModelBaseVO toVo(Model entity);


}
