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

import com.xunhong.erp.turbo.api.infra.dto.cmd.SettingUpdateCmd;
import com.xunhong.erp.turbo.infra.domain.entity.Setting;
import com.xunhong.erp.turbo.infra.infrastructure.entity.SettingDO;
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 SettingConvert {

	Setting toSetting(SettingDO settingDO);

	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "settingId", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	SettingDO toSettingDO(SettingUpdateCmd settingUpdateCmd);

	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "settingId", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	@Mapping(target = "settingKey", ignore = true)
	void toSettingDO(@MappingTarget SettingDO settingDO, SettingUpdateCmd settingUpdateCmd);
}

