package com.cf.imes.module.system.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.CustomExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.QueueBuilder;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

import static com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants.SYSTEM_ADVERTISEMENT_UPDATE_DELAYED_EXCHANGE;
import static com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants.SYSTEM_ADVERTISEMENT_UPDATE_DELAYED_QUEUE;
import static com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants.SYSTEM_ADVERTISEMENT_UPDATE_DELAYED_ROUTING_KEY;

/**
 * @author Gqr
 * @since 2025/5/13 11:42
 */
@Configuration
public class ChenfengRabbitMQSystemConfiguration {
    /**
     * 广告状态修改 延迟队列
     */
//    @Bean
//    public Queue advertisementUpdateDelayedQueue(){
//        return QueueBuilder.durable(SYSTEM_ADVERTISEMENT_UPDATE_DELAYED_QUEUE).build();
//    }
//
//    /**
//     * 广告状态修改 定义延迟交换机
//     */
//    @Bean
//    public CustomExchange advertisementUpdateDelayExchange() {
//        Map<String, Object> args = new HashMap<>();
//        args.put("x-delayed-type", "direct");
//        return new CustomExchange(SYSTEM_ADVERTISEMENT_UPDATE_DELAYED_EXCHANGE, "x-delayed-message", true, false, args);
//    }
//
//    /**
//     * 广告状态修改 队列与交换机绑定
//     */
//    @Bean
//    public Binding advertisementUpdateQueueABindingX(@Qualifier("advertisementUpdateDelayedQueue") Queue queue,
//                                                     @Qualifier("advertisementUpdateDelayExchange") CustomExchange delayedExchange){
//        return BindingBuilder.bind(queue)
//                .to(delayedExchange)
//                .with(SYSTEM_ADVERTISEMENT_UPDATE_DELAYED_ROUTING_KEY)
//                .noargs();
//    }
}
