package infrastructure.config;

import com.banesco.common.domain.model.redis.postgres.customer_product.CustomerAccountConfiguration;
import com.banesco.common.domain.model.redis.postgres.customer_product.CustomerAccountJsonConfig;
import com.banesco.common.domain.model.redis.postgres.customer_product.CustomerAccountPostgresConfig;
import com.banesco.common.infraestructure.repository.PostgresRedisRepository;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.redis.client.RedisClient;
import io.quarkus.runtime.annotations.RegisterForReflection;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.Produces;

@ApplicationScoped
@RegisterForReflection(targets = {
        CustomerAccountPostgresConfig.class,
        CustomerAccountConfiguration.class,
        CustomerAccountJsonConfig.class
})
public class PostgresRepositoryProducer {

    @Inject
    RedisClient redisClient;

    @Inject
    ObjectMapper objectMapper;

    @Produces
    @ApplicationScoped
    public PostgresRedisRepository postgresRedisRepository() {
        return new PostgresRedisRepository(redisClient, objectMapper);
    }

}