package com.bawei.es.remote.api;

import com.bawei.common.core.constant.ServiceNameConstants;
import com.bawei.common.core.domain.R;
import com.bawei.es.remote.factory.RemoteIndexFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 文件服务
 *
 * @author bawei
 */
@FeignClient(contextId = "remoteIndexService", value = ServiceNameConstants.ES_SERVICE, fallbackFactory = RemoteIndexFallbackFactory.class)
public interface RemoteIndexService
{
    @GetMapping("/index/{indexName}")
    public R exist(@PathVariable(value = "indexName") String indexName);

    @GetMapping("/index/getMapping/{indexName}")
    public R getMapping(@PathVariable(value = "indexName") String indexName);

    @PostMapping("/index/{indexName}")
    public R index(@PathVariable(value = "indexName") String indexName,@RequestBody Map<String,Object> mappings);

    @PutMapping("/index/{indexName}")
    public R updateIndex(@PathVariable(value = "indexName") String indexName,@RequestBody Map<String,Object> mappings);

    @DeleteMapping("/index/{indexName}")
    public R deleteIndex(@PathVariable(value = "indexName") String indexName);
}
