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

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.qinan.safetyeval.client.change.request.QualFilingCommitmentChangeAddCmd;
import org.qinan.safetyeval.client.change.request.QualFilingCommitmentChangeUpdateCmd;
import org.qinan.safetyeval.client.co.QualFilingCommitmentCO;
import org.qinan.safetyeval.domain.change.model.QualFilingCommitmentChangeE;
import org.qinan.safetyeval.domain.entity.QualFilingCommitmentEntity;

/**
 * 法定代人承诺书-变更转换
 *
 * @Author: ltq
 * @date 2026-07-02 09:38:30
 */
@Mapper(componentModel = "spring")
public interface QualFilingCommitmentChangeCmdConvertor {
    /**
     * cmd_add转领域模型
     *
     * @param qualFilingCommitmentChangeAddCmd
     * @return
     */
    @Mapping(target = "qualFilingCommitmentChangeGateway", ignore = true)
    QualFilingCommitmentChangeE convertCmdToE(QualFilingCommitmentChangeAddCmd qualFilingCommitmentChangeAddCmd);

    /**
     * cmd_update转领域模型
     *
     * @param qualFilingCommitmentChangeUpdateCmd
     * @return
     */
    @Mapping(target = "qualFilingCommitmentChangeGateway", ignore = true)
    QualFilingCommitmentChangeE convertCmdToE(QualFilingCommitmentChangeUpdateCmd qualFilingCommitmentChangeUpdateCmd);

    /**
     * 变更承诺书转承诺书实体
     */
    @Mapping(target = "id", ignore = true)
    @Mapping(target = "filingId", ignore = true)
    @Mapping(target = "tenantId", ignore = true)
    @Mapping(target = "orgId", ignore = true)
    QualFilingCommitmentEntity convertChangeEToEntity(QualFilingCommitmentChangeE changeE);

    /**
     * 变更承诺书转承诺书CO
     */
    @Mapping(source = "filingChangeId", target = "filingId")
    QualFilingCommitmentCO convertChangeEToCO(QualFilingCommitmentChangeE changeE);
}
