package infrastructure.mapper;

import application.port.input.command.ValidateProfileCommand;
import domain.model.ClientProfile;
import infrastructure.client.validateprofile.dto.request.ValidateProfileRequest;
import infrastructure.client.validateprofile.dto.response.ValidateProfileResponse;

/**
 * Clase de utilidad para mapear objetos entre las capas de la aplicación
 * para el flujo de validate profile
 */
public class ValidateProfileMapper {
    public static ClientProfile toEntity(ValidateProfileResponse dto) {
        return ClientProfile.builder()
            .errorMessage(dto.getErrorMessage())
            .errorCode(dto.getErrorCode())
            .hasError(dto.getHasError())
            .data(dto.getData())
            .build();
    }

    public static ValidateProfileRequest toRequestDto(ValidateProfileCommand command) {
        return ValidateProfileRequest.builder()
            .customerId(command.customerId())
            .ipAddress(command.ipAddress())
            .hash(command.hash())
            .build();
    }

}