package com.xindazhou.business.api.member;

import com.xindazhou.framework.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 * 会员等级 Feign 客户端
 * 用于调用用户服务（xdz-user-server）的接口
 *
 * @author xindazhou
 */
@FeignClient(name = "xdz-user-server", url = "${feign.user-server.url:}")
@Tag(name = "RPC 服务 - 会员等级")
public interface MemberLevelApi {

    String PREFIX = "/admin-api/member/level";

    @GetMapping(PREFIX + "/list")
    @Operation(summary = "获得会员等级列表")
    CommonResult<List<Map<String, Object>>> getLevelList(@SpringQueryMap Map<String, Object> listReqVO);

    @GetMapping(PREFIX + "/list-all-simple")
    @Operation(summary = "获取会员等级精简信息列表")
    CommonResult<List<Map<String, Object>>> getSimpleLevelList();

    @GetMapping(PREFIX + "/get")
    @Operation(summary = "获得会员等级")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    CommonResult<Map<String, Object>> getLevel(@RequestParam("id") Long id);

    @PostMapping(PREFIX + "/create")
    @Operation(summary = "创建会员等级")
    CommonResult<Long> createLevel(@Valid @RequestBody Map<String, Object> createReqVO);

    @PutMapping(PREFIX + "/update")
    @Operation(summary = "更新会员等级")
    CommonResult<Boolean> updateLevel(@Valid @RequestBody Map<String, Object> updateReqVO);

    @DeleteMapping(PREFIX + "/delete")
    @Operation(summary = "删除会员等级")
    @Parameter(name = "id", description = "编号", required = true)
    CommonResult<Boolean> deleteLevel(@RequestParam("id") Long id);
}

