package com.lanyuanxiaoyao.service.forest.service;

import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.Get;
import com.dtflys.forest.annotation.Query;
import com.lanyuanxiaoyao.service.configuration.entity.pulsar.PulsarNamespace;
import com.lanyuanxiaoyao.service.configuration.entity.pulsar.PulsarTenant;
import com.lanyuanxiaoyao.service.configuration.entity.pulsar.PulsarTopic;
import org.eclipse.collections.api.list.ImmutableList;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Pulsar
 *
 * @author lanyuanxiaoyao
 * @date 2023-04-28
 */
@BaseRequest(baseURL = "http://service-pulsar-query/pulsar")
public interface PulsarService {
    @Get("/name")
    String name(@Query("pulsar_url") String pulsarUrl);

    @Get("/names")
    ImmutableList<String> names();

    @Get("/tenants")
    ImmutableList<PulsarTenant> tenants(@Query("name") String name);

    @Get("/namespaces")
    ImmutableList<PulsarNamespace> namespaces(@Query("name") String name, @Query("tenant") String tenant);

    @Get("/topic")
    PulsarTopic topic(@Query("name") String name, @Query("topic") String topic);

    @Get("/topics")
    ImmutableList<PulsarTopic> topics(@Query("name") String name, @Query("namespace") String namespace);

    @Get("/backlog")
    Long backlog(@Query("name") String name, @Query("topic") String topic, @Query("subscription") String subscription);

    @Get("/exists_topic")
    Boolean existsTopic(@Query("url") String url, @Query("topic") String topic);
}
