package com.xindazhou.business.api.member;

import com.xindazhou.framework.common.pojo.CommonResult;
import com.xindazhou.framework.common.pojo.PageResult;
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.Map;

/**
 * 会员用户 Feign 客户端
 * 用于调用用户服务（xdz-user-server）的接口
 */
@FeignClient(name = "xdz-user-server", url = "${feign.user-server.url:}") // 使用服务名，Nacos 会自动发现
@Tag(name = "RPC 服务 - 会员用户")
public interface MemberUserApi {

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

    @GetMapping(PREFIX + "/page")
    @Operation(summary = "获得会员用户分页")
    CommonResult<PageResult<Map<String, Object>>> getUserPage(@SpringQueryMap Map<String, Object> pageVO);

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

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

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

    @PutMapping(PREFIX + "/update-point")
    @Operation(summary = "更新会员用户积分")
    CommonResult<Boolean> updateUserPoint(@Valid @RequestBody Map<String, Object> updateReqVO);
}

