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

import com.red.circle.common.business.enums.SVIPLevelEnum;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.user.user.UserSvipClientService;
import com.red.circle.other.inner.endpoint.user.user.api.UserSvipClientApi;
import java.util.Map;
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;

/**
 * 用户svip.
 *
 * @author pengliang on 2023/6/6
 */
@Validated
@RestController
@RequestMapping(value = UserSvipClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class UserSvipClientEndpoint implements UserSvipClientApi {

  private final UserSvipClientService userSvipClientService;

  @Override
  public ResultResponse<SVIPLevelEnum> checkSVipIdentity(Long userId) {
    return ResultResponse.success(userSvipClientService.checkSVipIdentity(userId));
  }

  @Override
  public ResultResponse<Map<Long, SVIPLevelEnum>> mapCheckSVipIdentity(Set<Long> userIds) {
    return ResultResponse.success(userSvipClientService.mapCheckSVipIdentity(userIds));
  }

  @Override
  public ResultResponse<Void> incrIntegral(Long userId, Long integral) {
    userSvipClientService.incrIntegral(userId, integral);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Boolean> existSVipProps(String sysOrigin, Long propsId) {
    return ResultResponse.success(userSvipClientService.existSVipProps(sysOrigin, propsId));
  }

}
