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.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 MemberGroupApi {

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

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

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

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

    @PostMapping(PREFIX + "/create")
    @Operation(summary = "创建用户分组")
    CommonResult<Long> createGroup(@Valid @RequestBody Map<String, Object> createReqVO);

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

    @DeleteMapping(PREFIX + "/delete")
    @Operation(summary = "删除用户分组")
    @Parameter(name = "id", description = "编号", required = true)
    CommonResult<Boolean> deleteGroup(@RequestParam("id") Long id);
}

