package com.jeeplus.sys.feign;

import com.jeeplus.common.constant.AppNameConstants;
import com.jeeplus.sys.factory.DictApiFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(contextId = "dictApi", name = AppNameConstants.APP_SYSTEM_SERVICE, fallbackFactory = DictApiFallbackFactory.class)
public interface IDictApi {
    /**
     * 获取字典值
     *
     * @return
     */
    @GetMapping(value = "/feign/sys/dict/getDictValue")
    String getDictValue(@RequestParam(value = "label") String label, @RequestParam(value = "type") String type, @RequestParam(value = "defaultValue", required = false) String defaultValue);

    /**
     * 获取字典标签
     *
     * @param value
     * @param type
     * @param defaultLabel
     * @return
     */
    @GetMapping(value = "/feign/sys/dict/getDictLabel")
    String getDictLabel(@RequestParam(value = "value") String value, @RequestParam(value = "type") String type, @RequestParam(value = "defaultLabel", required = false) String defaultLabel);

    /**
     * 获取字典标签
     *
     * @param dict
     * @return
     */
    @GetMapping(value = "/feign/sys/dict/getDictMap")
    String getDictMap(@RequestParam(value = "dict") String dict);

    /**
     * 获取字典标签
     *
     * @param dict
     * @return
     */
    @GetMapping(value = "/feign/sys/dict/getDictListMapByDict")
    String getDictListMapByDict(@RequestParam(value = "dict") String dict);


    /**
     * 获取字典值
     *
     * @param dict
     * @return
     */
    @GetMapping(value = "/feign/sys/dict/getDictValueListMapByDict")
    String getDictValueListMapByDict(@RequestParam(value = "dict") String dict);


    /**
     * 修改value值
     * @param label
     * @param value
     * @return
     */
    @GetMapping(value = "/feign/sys/dict/updateDictValue")
    void updateDictValue(@RequestParam(value = "label") String label, @RequestParam(value = "value") String value);
}
