package infrastructure.mapper;

import application.port.input.command.ServiceStatusCommand;
import com.banesco.common.infraestructure.web.dto.request.ServiceStatusRequest;
import com.banesco.common.infraestructure.web.dto.response.ServiceStatusResponse;
import domain.model.ServiceStatus;

public class ServiceStatusMapper {
    public static ServiceStatus toEntity(ServiceStatusResponse dto) {
        return ServiceStatus.builder()
                .status(dto.getStatus())
                .build();
    }

    public static ServiceStatusRequest toRequestDto(ServiceStatusCommand command) {
        var bankServiceDto = new com.banesco.common.infraestructure.web.dto.request.BankService();
        bankServiceDto.setBankCode(command.bankService().bankCode());
        bankServiceDto.setServiceCode(command.bankService().serviceCode());
        bankServiceDto.setEventCode(command.bankService().eventCode());

        // Construye y devuelve el DTO principal
        var requestDto = new ServiceStatusRequest();
        requestDto.setApplicationId(command.applicationId());
        requestDto.setTransactionId(command.transactionId());
        requestDto.setBankService(bankServiceDto);
        return requestDto;

    }



}
