package com.xunhong.erp.turbo.infra.infrastructure.convert;

import com.xunhong.erp.turbo.api.infra.dto.cmd.AgreementCreateCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.AgreementUpdateCmd;
import com.xunhong.erp.turbo.infra.domain.entity.Agreement;
import com.xunhong.erp.turbo.infra.infrastructure.entity.AgreementDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValueCheckStrategy;

/**
 * @author shenyifei
 */
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface AgreementConvert {

	Agreement toAgreement(AgreementDO agreementDO);

	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	AgreementDO toAgreementDO(AgreementCreateCmd agreementCreateCmd);

	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	void toAgreementDO(@MappingTarget AgreementDO agreementDO, AgreementUpdateCmd agreementUpdateCmd);
}

