package com.red.circle.other.app.inner.endpoint.user.user;


import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.user.user.UserRechargeClientService;
import com.red.circle.other.inner.endpoint.user.user.api.UserRechargeClientApi;
import java.util.Set;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 邀请用户.
 *
 * @author pengliang on 2023/8/18
 */
@Validated
@RestController
@RequestMapping(value = UserRechargeClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class UserRechargeClientEndpoint implements UserRechargeClientApi {

  private final UserRechargeClientService userRechargeClientService;


  @Override
  public ResultResponse<Set<String>> getKeys() {
    return ResultResponse.success(userRechargeClientService.getKeys());
  }

  @Override
  public ResultResponse<Void> addRechargeBlack(String userId) {
    userRechargeClientService.addRechargeBlack(userId);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Void> delKey(String key) {
    userRechargeClientService.delKey(key);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Boolean> checkRechargeBlack(String userId) {
    return ResultResponse.success(userRechargeClientService.checkRechargeBlack(userId));
  }
}
