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

import com.xunhong.erp.turbo.api.infra.dto.cmd.DictionaryCreateCmd;
import com.xunhong.erp.turbo.api.infra.dto.cmd.DictionaryUpdateCmd;
import com.xunhong.erp.turbo.infra.domain.entity.Dictionary;
import com.xunhong.erp.turbo.infra.infrastructure.entity.DictionaryDO;
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 DictionaryConvert {

	Dictionary toDictionary(DictionaryDO dictionaryDO);

	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	DictionaryDO toDictionaryDO(DictionaryCreateCmd dictionaryCreateCmd);

	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	void toDictionaryDO(@MappingTarget DictionaryDO dictionaryDO, DictionaryUpdateCmd dictionaryUpdateCmd);
}

