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

import com.xunhong.erp.turbo.api.user.dto.cmd.EmployeeCreateCmd;
import com.xunhong.erp.turbo.api.user.dto.cmd.EmployeeUpdateCmd;
import com.xunhong.erp.turbo.user.domain.entity.Employee;
import com.xunhong.erp.turbo.user.infrastructure.entity.EmployeeDO;
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 EmployeeConvert {

	Employee toEmployee(EmployeeDO employeeDO);

	@Mapping(target = "version", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "employeeId", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	EmployeeDO toEmployeeDO(EmployeeCreateCmd employeeCreateCmd);

	@Mapping(target = "version", ignore = true)
	@Mapping(target = "userId", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	void toEmployeeDO(@MappingTarget EmployeeDO employeeDO, EmployeeUpdateCmd employeeUpdateCmd);
}
