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

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.qinan.safetyeval.client.change.request.QualFilingPersonnelChangeAddCmd;
import org.qinan.safetyeval.client.change.request.QualFilingPersonnelChangeUpdateCmd;
import org.qinan.safetyeval.client.co.QualFilingPersonnelCO;
import org.qinan.safetyeval.domain.change.model.QualFilingPersonnelChangeE;
import org.qinan.safetyeval.domain.entity.QualFilingPersonnelEntity;

import java.util.List;

/**
 * 备案申请人员-变更转换
 *
 * @Author: ltq
 * @date 2026-07-02 10:04:33
 */
@Mapper(componentModel = "spring")
public interface QualFilingPersonnelChangeCmdConvertor {
    /**
     * cmd_add转领域模型
     *
     * @param qualFilingPersonnelChangeAddCmd
     * @return
     */
    @Mapping(target = "qualFilingPersonnelChangeGateway", ignore = true)
    QualFilingPersonnelChangeE convertCmdToE(QualFilingPersonnelChangeAddCmd qualFilingPersonnelChangeAddCmd);

    /**
     * cmd_update转领域模型
     *
     * @param qualFilingPersonnelChangeUpdateCmd
     * @return
     */
    @Mapping(target = "qualFilingPersonnelChangeGateway", ignore = true)
    QualFilingPersonnelChangeE convertCmdToE(QualFilingPersonnelChangeUpdateCmd qualFilingPersonnelChangeUpdateCmd);

    /**
     * 变更人员转人员实体
     */
    @Mapping(target = "id", ignore = true)
    @Mapping(target = "filingId", ignore = true)
    @Mapping(target = "tenantId", ignore = true)
    @Mapping(target = "orgId", ignore = true)
    QualFilingPersonnelEntity convertChangeEToEntity(QualFilingPersonnelChangeE changeE);

    /**
     * 批量转换
     */
    List<QualFilingPersonnelEntity> convertChangeEListToEntityList(List<QualFilingPersonnelChangeE> changeEs);

    /**
     * 变更人员转人员CO
     */
    @Mapping(source = "filingChangeId", target = "filingId")
    QualFilingPersonnelCO convertChangeEToCO(QualFilingPersonnelChangeE changeE);

    /**
     * 批量转换变更人员为CO
     */
    List<QualFilingPersonnelCO> convertChangeEListToCOList(List<QualFilingPersonnelChangeE> changeEs);
}
