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

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.qinan.safetyeval.client.change.request.QualFilingPersonnelCertChangeAddCmd;
import org.qinan.safetyeval.client.change.request.QualFilingPersonnelCertChangeUpdateCmd;
import org.qinan.safetyeval.client.co.QualFilingPersonnelCertCO;
import org.qinan.safetyeval.domain.change.model.QualFilingPersonnelCertChangeE;
import org.qinan.safetyeval.domain.entity.QualFilingPersonnelCertEntity;

import java.util.List;

/**
 * 备案申请人员证书转换
 *
 * @Author: ltq
 * @date 2026-07-02 10:04:23
 */
@Mapper(componentModel = "spring")
public interface QualFilingPersonnelCertChangeCmdConvertor {
    /**
     * cmd_add转领域模型
     *
     * @param qualFilingPersonnelCertChangeAddCmd
     * @return
     */
    @Mapping(target = "qualFilingPersonnelCertChangeGateway", ignore = true)
    QualFilingPersonnelCertChangeE convertCmdToE(QualFilingPersonnelCertChangeAddCmd qualFilingPersonnelCertChangeAddCmd);

    /**
     * cmd_update转领域模型
     *
     * @param qualFilingPersonnelCertChangeUpdateCmd
     * @return
     */
    @Mapping(target = "qualFilingPersonnelCertChangeGateway", ignore = true)
    QualFilingPersonnelCertChangeE convertCmdToE(QualFilingPersonnelCertChangeUpdateCmd qualFilingPersonnelCertChangeUpdateCmd);

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

    /**
     * 批量转换
     */
    List<QualFilingPersonnelCertEntity> convertChangeEListToEntityList(List<QualFilingPersonnelCertChangeE> changeEs);

    /**
     * 变更人员证书转人员证书CO
     */
    @Mapping(source = "filingChangeId", target = "filingId")
    QualFilingPersonnelCertCO convertChangeEToCO(QualFilingPersonnelCertChangeE changeE);

    /**
     * 批量转换变更人员证书为CO
     */
    List<QualFilingPersonnelCertCO> convertChangeEListToCOList(List<QualFilingPersonnelCertChangeE> changeEs);
}
