package org.springblade.system.client;

import org.springblade.common.openfeign.OpenFeignConstants;
import org.springblade.system.client.factory.MenuClientFallbackFactory;
import org.springblade.system.client.model.BladeMenuModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(contextId = "menuClient",
        value = OpenFeignConstants.SYSTEM_SERVICE,
        fallbackFactory = MenuClientFallbackFactory.class)
public interface MenuClient {

    /**
     * 根据租户 id 查询菜单
     */
    @GetMapping(OpenFeignConstants.SYSTEM_SERVICE + "/menu/list/{tenantId}")
    public List<BladeMenuModel> getByTenantId(@PathVariable String tenantId);

    @PostMapping(OpenFeignConstants.SYSTEM_SERVICE + "/menu/saves")
    public void saveList(@RequestBody List<BladeMenuModel> menuModels);

    @PostMapping(OpenFeignConstants.SYSTEM_SERVICE + "/menu/save")
    public Long save(@RequestBody BladeMenuModel menuModel);
}
