package com.ycwl.basic.integration.kafka.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Data
@Component
@ConfigurationProperties(prefix = "kafka")
public class KafkaIntegrationProperties {

    private boolean enabled = false;
    private String bootstrapServers = "100.64.0.12:39092";
    private String ztMessageTopic = "zt-message"; // topic for zt-message microservice
    private String profitShareTopic = "zt-profitshare"; // topic for profit share messages
    private String refundTopic = "zt-profitshare-refund"; // topic for refund messages
    private Consumer consumer = new Consumer();
    private Producer producer = new Producer();

    @Data
    public static class Consumer {
        private String groupId = "liuying-microservice";
        private String autoOffsetReset = "earliest";
        private String keyDeserializer = "org.apache.kafka.common.serialization.StringDeserializer";
        private String valueDeserializer = "org.apache.kafka.common.serialization.StringDeserializer";
    }

    @Data
    public static class Producer {
        private String acks = "all";
        private Integer retries = 3;
        private Integer batchSize = 16384;
        private Integer lingerMs = 1;
        private Integer bufferMemory = 33554432;
        private String keySerializer = "org.apache.kafka.common.serialization.StringSerializer";
        private String valueSerializer = "org.apache.kafka.common.serialization.StringSerializer";
    }
}