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


import com.xunhong.erp.turbo.api.user.dto.cmd.UserAuthCreateCmd;
import com.xunhong.erp.turbo.user.domain.entity.UserAuth;
import com.xunhong.erp.turbo.user.infrastructure.entity.UserAuthDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;

/**
 * @author shenyifei
 */
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, uses = {UserConvert.class})
public interface UserAuthConvert {

	@Mapping(target = "type", ignore = true)
	@Mapping(target = "user", source = "userDO")
	UserAuth toUserAuth(UserAuthDO userAuthDO);

	@Mapping(target = "version", ignore = true)
	@Mapping(target = "userId", ignore = true)
	@Mapping(target = "userDO", ignore = true)
	@Mapping(target = "userAuthId", ignore = true)
	@Mapping(target = "updatedAt", ignore = true)
	@Mapping(target = "state", ignore = true)
	@Mapping(target = "isDelete", ignore = true)
	@Mapping(target = "createdAt", ignore = true)
	UserAuthDO toUserAuthDO(UserAuthCreateCmd userAuthCreateCmd);
}
