package cn.ey.biz.module.system.api.category;

import cn.ey.biz.common.pojo.R;
import cn.ey.biz.module.system.api.category.dto.DictCatalogDTO;
import cn.ey.biz.module.system.enums.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = ApiConstants.NAME)
@Api(tags = "RPC 服务 - 分类配置数据")
public interface CategoryDataApi {

    String PREFIX = ApiConstants.PREFIX + "/category-data";

    @GetMapping(PREFIX + "/get")
    @ApiOperation("获得指定的配置数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "app", value = "应用", example = "system", required = true, dataTypeClass = String.class),
            @ApiImplicitParam(name = "category", value = "分类", example = "common", required = true, dataTypeClass = String.class),
            @ApiImplicitParam(name = "key", value = "配置键", example = "level", required = true, dataTypeClass = String.class)
    })
    R<String> get(@RequestParam("app") String app, @RequestParam("category") String category, @RequestParam("key") String key);

    @PostMapping(PREFIX + "/import")
    @ApiOperation("批量导入菜单目录")
    R<Void> importDictCatalog(@RequestBody List<DictCatalogDTO> dictCatalogs);
}
