package com.emonster.taroaichat.service.mapper;

import com.emonster.taroaichat.domain.User;
import com.emonster.taroaichat.domain.UserProfile;
import com.emonster.taroaichat.service.dto.UserDTO;
import com.emonster.taroaichat.service.dto.UserProfileDTO;
import org.mapstruct.*;

/**
 * Mapper for the entity {@link UserProfile} and its DTO {@link UserProfileDTO}.
 */
@Mapper(componentModel = "spring")
public interface UserProfileMapper extends EntityMapper<UserProfileDTO, UserProfile> {
    @BeanMapping(ignoreByDefault = true)
    @Mapping(target = "user", source = "user", qualifiedByName = "userLogin")
    @Mapping(target = "id", source = "id")
    @Mapping(target = "birthday", source = "birthday")
    @Mapping(target = "gender", source = "gender")
    @Mapping(target = "occupation", source = "occupation")
    @Mapping(target = "phone", source = "phone")
    @Mapping(target = "lastActive", source = "lastActive")
    @Mapping(target = "createdDate", source = "createdDate")
    UserProfileDTO toDto(UserProfile s);

    @Named("userLogin")
    @BeanMapping(ignoreByDefault = true)
    @Mapping(target = "id", source = "id")
    @Mapping(target = "login", source = "login")
    UserDTO toDtoUserLogin(User user);
}
