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.PageResponse;
import com.lanyuanxiaoyao.service.configuration.entity.hudi.HudiCleanerPlan;
import com.lanyuanxiaoyao.service.configuration.entity.hudi.HudiCompactionPlan;
import com.lanyuanxiaoyao.service.configuration.entity.hudi.HudiInstant;
import com.lanyuanxiaoyao.service.configuration.entity.hudi.HudiRollbackPlan;
import java.util.Map;
import org.eclipse.collections.api.list.ImmutableList;
import org.eclipse.collections.api.map.ImmutableMap;

/**
 * Hudi 操作
 *
 * @author lanyuanxiaoyao
 * @date 2023-05-01
 */
@BaseRequest(baseURL = "http://service-hudi-query")
public interface HudiService {
    @Get("/timeline/list")
    PageResponse<HudiInstant> timelineList(@Query Map<String, Object> queryMap);

    @Get("/timeline/list_hdfs")
    PageResponse<HudiInstant> timelineHdfsList(@Query Map<String, Object> queryMap);

    @Get("/timeline/read_compaction_plan")
    HudiCompactionPlan readCompactionPlan(@Query("flink_job_id") Long flinkJobId, @Query("alias") String alias, @Query("instant") String instant);

    @Get("/timeline/read_compaction_plan_hdfs")
    HudiCompactionPlan readCompactionPlanHdfs(@Query("hdfs") String hdfs, @Query("instant") String instant);

    @Get("/timeline/read_rollback_plan")
    HudiRollbackPlan readRollbackPlan(@Query("flink_job_id") Long flinkJobId, @Query("alias") String alias, @Query("instant") String instant);

    @Get("/timeline/read_rollback_plan_hdfs")
    HudiRollbackPlan readRollbackPlanHdfs(@Query("hdfs") String hdfs, @Query("instant") String instant);

    @Get("/timeline/read_cleaner_plan")
    HudiCleanerPlan readCleanerPlan(@Query("flink_job_id") Long flinkJobId, @Query("alias") String alias, @Query("instant") String instant);

    @Get("/timeline/read_cleaner_plan_hdfs")
    HudiCleanerPlan readCleanerPlanHdfs(@Query("hdfs") String hdfs, @Query("instant") String instant);

    @Get("/timeline/list_pending_compaction")
    ImmutableList<HudiInstant> timelinePendingCompactionList(@Query("flink_job_id") Long flinkJobId, @Query("alias") String alias);

    @Get("/timeline/exists_compaction_plan")
    Boolean existsCompactionPlan(@Query("flink_job_id") Long flinkJobId, @Query("alias") String alias);

    @Get("/table/schema")
    ImmutableMap<String, Object> schema(@Query("flink_job_id") Long flinkJobId, @Query("alias") String alias);

    @Get("/table/schema_hdfs")
    ImmutableMap<String, Object> schema(@Query("hdfs") String hdfs);

    @Get("/hdfs/exists_hudi_table_by_flink_job_id_alias")
    Boolean existsHudiTable(@Query("flink_job_id") Long flinkJobId, @Query("alias") String alias);

    @Get("/hdfs/exists_hudi_table_by_hdfs")
    Boolean existsHudiTable(@Query("hdfs") String hdfs);

    @Get("/hdfs/exists_path")
    Boolean existsPath(@Query("hdfs") String hdfs);
}
