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

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.qinan.safetyeval.client.change.request.QualFilingEquipmentChangeAddCmd;
import org.qinan.safetyeval.client.change.request.QualFilingEquipmentChangeUpdateCmd;
import org.qinan.safetyeval.client.co.QualFilingEquipmentCO;
import org.qinan.safetyeval.domain.change.model.QualFilingEquipmentChangeE;
import org.qinan.safetyeval.domain.entity.QualFilingEquipmentEntity;

import java.util.List;

/**
 * 备案申请装备-变更转换
 *
 * @Author: ltq
 * @date 2026-07-02 10:03:59
 */
@Mapper(componentModel = "spring")
public interface QualFilingEquipmentChangeCmdConvertor {
    /**
     * cmd_add转领域模型
     *
     * @param qualFilingEquipmentChangeAddCmd
     * @return
     */
    @Mapping(target = "qualFilingEquipmentChangeGateway", ignore = true)
    QualFilingEquipmentChangeE convertCmdToE(QualFilingEquipmentChangeAddCmd qualFilingEquipmentChangeAddCmd);

    /**
     * cmd_update转领域模型
     *
     * @param qualFilingEquipmentChangeUpdateCmd
     * @return
     */
    @Mapping(target = "qualFilingEquipmentChangeGateway", ignore = true)
    QualFilingEquipmentChangeE convertCmdToE(QualFilingEquipmentChangeUpdateCmd qualFilingEquipmentChangeUpdateCmd);

    /**
     * 变更装备转装备实体
     */
    @Mapping(target = "id", ignore = true)
    @Mapping(target = "filingId", ignore = true)
    @Mapping(target = "tenantId", ignore = true)
    @Mapping(target = "orgId", ignore = true)
    QualFilingEquipmentEntity convertChangeEToEntity(QualFilingEquipmentChangeE changeE);

    /**
     * 批量转换
     */
    List<QualFilingEquipmentEntity> convertChangeEListToEntityList(List<QualFilingEquipmentChangeE> changeEs);

    /**
     * 变更装备转装备CO
     */
    @Mapping(source = "filingChangeId", target = "filingId")
    QualFilingEquipmentCO convertChangeEToCO(QualFilingEquipmentChangeE changeE);

    /**
     * 批量转换变更装备为CO
     */
    List<QualFilingEquipmentCO> convertChangeEListToCOList(List<QualFilingEquipmentChangeE> changeEs);
}
