package com.tashow.cloud.systemapi.api.social;

import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.systemapi.api.social.dto.*;
import com.tashow.cloud.systemapi.enums.ApiConstants;
import jakarta.validation.Valid;
import java.util.List;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = ApiConstants.NAME) // TODO 芋艿：fallbackFactory =
/** RPC 服务 - 社交应用 */
public interface SocialClientApi {

  String PREFIX = ApiConstants.PREFIX + "/social-client";

  @GetMapping(PREFIX + "/get-authorize-url")
  /** 获得社交平台的授权 URL */
  CommonResult<String> getAuthorizeUrl(
      @RequestParam("socialType") Integer socialType,
      @RequestParam("userType") Integer userType,
      @RequestParam("redirectUri") String redirectUri);

  @GetMapping(PREFIX + "/create-wx-mp-jsapi-signature")
  /** 创建微信公众号 JS SDK 初始化所需的签名 */
  CommonResult<SocialWxJsapiSignatureRespDTO> createWxMpJsapiSignature(
      @RequestParam("userType") Integer userType, @RequestParam("url") String url);

  @GetMapping(PREFIX + "/create-wx-ma-phone-number-info")
  /** 获得微信小程序的手机信息 */
  CommonResult<SocialWxPhoneNumberInfoRespDTO> getWxMaPhoneNumberInfo(
      @RequestParam("userType") Integer userType, @RequestParam("phoneCode") String phoneCode);

  @GetMapping(PREFIX + "/get-wxa-qrcode")
  /** 获得小程序二维码 */
  CommonResult<byte[]> getWxaQrcode(@SpringQueryMap SocialWxQrcodeReqDTO reqVO);

  @GetMapping(PREFIX + "/get-wxa-subscribe-template-list")
  /** 获得微信小程订阅模板 */
  CommonResult<List<SocialWxaSubscribeTemplateRespDTO>> getWxaSubscribeTemplateList(
      @RequestParam("userType") Integer userType);

  @PostMapping(PREFIX + "/send-wxa-subscribe-message")
  /** 发送微信小程序订阅消息 */
  CommonResult<Boolean> sendWxaSubscribeMessage(
      @Valid @RequestBody SocialWxaSubscribeMessageSendReqDTO reqDTO);
}
