import request from '@/utils/request';
import type { ApiResult } from '@/api';
import {UserVerify} from "@/api/system/userVerify/model";
import {ShopDealerWithdraw} from "@/api/shop/shopDealerWithdraw/model";

/**
 * 升级为管理员
 * 推送模版消息
 */
export async function pushByUpdateAdmin(userId: number) {
  const res = await request.get<ApiResult<unknown>>(
    '/sdy/sdy-template-message/' + userId
  );
  if (res.code === 0) {
    return res.message;
  }
  return Promise.reject(new Error(res.message));
}

/**
 * 通知管理员审核操作提醒
 */
export async function pushReviewReminder(data: UserVerify) {
  const res = await request.post<ApiResult<unknown>>(
    '/sdy/sdy-template-message/pushReviewReminder',
    data
  );
  if (res.code === 0) {
    return res.message;
  }
  return Promise.reject(new Error(res.message));
}
/**
 * 通知管理员去提现审核操作提醒
 */
export async function pushWithdrawalReviewReminder(data: ShopDealerWithdraw) {
  const res = await request.post<ApiResult<unknown>>(
    '/sdy/sdy-template-message/pushWithdrawalReviewReminder',
    data
  );
  if (res.code === 0) {
    return res.message;
  }
  return Promise.reject(new Error(res.message));
}

/**
 * 提现成功通知
 */
export async function pushNoticeOfWithdrawalToAccount(data: ShopDealerWithdraw) {
  const res = await request.post<ApiResult<unknown>>(
    '/sdy/sdy-template-message/pushNoticeOfWithdrawalToAccount',
    data
  );
  if (res.code === 0) {
    return res.message;
  }
  return Promise.reject(new Error(res.message));
}


