package com.yuchen.saas.manage.system.api.feign;

import cn.hutool.core.lang.tree.Tree;
import com.yuchen.saas.manage.system.api.entity.AreaCode;
import org.nest.springwrap.core.launch.app.AppNameConstant;
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(
        value = AppNameConstant.SAAS_SYSTEM,
        fallback = IAreaCodeClientFallback.class
)
public interface IAreaCodeClient {
    String API_PREFIX = "/areacode/feign";
    String GET_AREA_CODE = API_PREFIX + "/getAreaCode";
    String GET_AREA_TREE=API_PREFIX+"/getAreaTree";


    @GetMapping(GET_AREA_CODE)
    List<AreaCode> getAreaCode(@RequestParam(required = false) Integer level, @RequestParam(required = false) String parentCode);

    @GetMapping(GET_AREA_TREE)
    List<Tree<String>> getAreaTree(@RequestParam Integer level);
}
