package org.qinan.safetyeval.app.change.convertor;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.qinan.safetyeval.client.co.QualFilingChangeAggregationCO;
import org.qinan.safetyeval.client.dto.QualFilingChangeAddCmd;
import org.qinan.safetyeval.domain.entity.QualFilingChangeEntity;
import org.qinan.safetyeval.domain.entity.QualFilingEntity;

/**
 * 备案变更基本信息命令转换
 *
 * @author safety-eval
 */
@Mapper(componentModel = "spring")
public interface QualFilingChangeCmdConvertor {

    /**
     * cmd_add转领域模型
     *
     * @param qualFilingChangeAddCmd
     * @return
     */
    QualFilingChangeEntity convertCmdToE(QualFilingChangeAddCmd qualFilingChangeAddCmd);

    /**
     * 变更实体转备案实体
     * id 由调用方手动设置（使用 changeFilingId）
     */
    @Mapping(target = "id", ignore = true)
    @Mapping(target = "originFilingId", ignore = true)
    @Mapping(target = "rejectReason", ignore = true)
    @Mapping(target = "submitTime", ignore = true)
    @Mapping(target = "approveTime", ignore = true)
    @Mapping(target = "applyTypeCode", ignore = true)
    @Mapping(target = "applyTypeName", ignore = true)
    QualFilingEntity convertChangeEToEntity(QualFilingChangeEntity changeEntity);

    /**
     *
     * @param changeEntity changeEntity
     * @return QualFilingChangeAggregationCO
     */
    QualFilingChangeAggregationCO convertChangeEToQualFilingChangeAggregationCO(QualFilingChangeEntity changeEntity);
}
