package com.banesco.common.application.helper;

import com.banesco.common.infrastructure.config.RequestValidationConfig;
import com.banesco.module.service_order_payment_search.domain.dto.request.ServiceOrderPaymentSearchRequest;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;
import java.util.List;

@Slf4j
@ApplicationScoped
public class RequestValidatorHelper {
    private final RequestValidationConfig config;

    private static final String REQUIRED_CODE = "VDE01";
    private static final String VALIDATE_CODE = "VDE02";

    @Inject
    public RequestValidatorHelper(
        RequestValidationConfig config
    ) {
        this.config = config;
    }

    public boolean isBol(
        ServiceOrderPaymentSearchRequest request
    ) {
        List<String> bolKeys = Arrays.stream(config.bolKeys().split(",")).toList();

        return bolKeys.contains(request.getChannelCode().toUpperCase());
    }

    public boolean isBole(
        ServiceOrderPaymentSearchRequest request
    ) {
        List<String> boleKeys = Arrays.stream(config.boleKeys().split(",")).toList();

        return boleKeys.contains(request.getChannelCode().toUpperCase());
    }
}
