import { http, httpDelete, httpGet, httpPost, httpPut } from '../../utils/http'
import { Schedule } from '../models/schedule'
import {
  Category,
  Content,
  DictType,
  MaterialDealer,
  MaterialDealerHomePage,
  MaterialDealerRes,
  Comment,
  Activity,
  BannerMode,
  Banner,
  StudyTour,
  PointsOrder,
  UserAuthInfo,
  ResPageData,
  Message,
  Coupon,
  MyStudyTour,
  Badge,
  Certificate,
  UserBasicInfo,
  ActivitySignUp,
  Product,
  ConfirmOrder,
} from './models'
import dayjs from 'dayjs'
import { AgreementType } from '@/core/libs/enums'

export const getUserInfo = () =>
  httpGetMock<any>({
    avatar: 'https://via.placeholder.com/21x21',
    nickname: '苏小萌',
  })
export const getSchedule = () =>
  httpGetMock<Schedule>({
    name: '东京艺术设计研习营',
    cover: 'https://via.placeholder.com/375x297',
    items: [
      {
        title: '早稻田大学课程',
        time: '9:00',
        content:
          '是位于日本东京都新宿区的一所著名的私立大学。它由早稻田大学的创始人大隈重信于1882年创立，是日本超级国际化大学计划（Top Global University Project）选定的大学之一，也是日本顶尖的高等教育机构之一。',
        momentExample: 'https://via.placeholder.com/285x157',
        monentHint: '*说明：打卡地XX，收集上课素材',
      },
      {
        title: '早稻田大学博物馆参观',
        time: '11:00',
        content:
          '早稻田大学拥有多座博物馆，‌其中最著名的是早稻田大学历史馆。‌早稻田大学历史馆收藏、‌展示着著名校友在运动方面的杰出表现和成就，‌馆内的解说牌以日语和英语标示，‌展现了传统样式风格的建筑。',
        momentExample: 'https://via.placeholder.com/285x157',
        monentHint: '*说明：打卡地XX，收集上课素材',
      },
    ],
  })
export const getClassmates = () =>
  httpGetMock<any[]>([
    {
      avatar: 'https://via.placeholder.com/35x35',
      nickname: '苏小萌',
      level: '0',
    },
    {
      avatar: 'https://via.placeholder.com/35x35',
      nickname: '苏小萌',
      level: '0',
    },
    {
      avatar: 'https://via.placeholder.com/35x35',
    },
  ])
export const getClassmate = () =>
  httpGetMock<any>({
    title: '2023同学荟|清华空间环境艺术设计研修班 阔步向未来',
    author: {
      avatar: 'https://via.placeholder.com/35x35',
      nickname: '苏小萌',
      level: '0',
    },
    viewNum: 125,
    createdAt: dayjs('2024-07-15').toDate(),
    content: '<div>111111</div>',
  })
export const getMaterialDealers = () =>
  httpGetMock<any[]>([
    {
      name: 'IMOLA瓷砖',
      icon: 'https://via.placeholder.com/78x78',
      brandType: '进口品牌',
      type: '瓷砖',
      views: 1000,
      createdAt: dayjs('2024-07-15').toDate(),
    },
    {
      name: 'IMOLA瓷砖',
      icon: 'https://via.placeholder.com/78x78',
      brandType: '进口品牌',
      type: '瓷砖',
      views: 1000,
      createdAt: dayjs('2024-07-15').toDate(),
    },
  ])
export const weixinMiniAppLogin = (phoneCode: string, loginCode: string, state: string) =>
  httpPost<any>('/app-api/member/auth/weixin-mini-app-login', {
    phoneCode,
    loginCode,
    state,
  })
export const getPhoneCode = (data: { mobile: string; scene: 2 }) =>
  httpPost<any>('/app-api/member/auth/send-sms-code', data)
export const testLogin = (data: { mobile: string; password: string }) =>
  httpPost<any>('/app-api/member/auth/login2', data)
/**
 * 修改手机号
 */
export const updateMobile = (data: { mobile: string; code: string }) =>
  httpPut('/app-api/member/user/update-mobile', data)
export const getMemberUserInfo = () => httpGet<any>('/app-api/member/user/get')
export const updateMemberUserInfo = (data = {}) => httpPut<any>('/app-api/member/user/update', data)
export const getByDictType = (
  type: string | 'member_channel_source' | 'member_spatial_expertise_type' | DictType,
) =>
  httpGet<
    {
      label: string
      value: string
      dictType: string
      status: number
    }[]
  >('/app-api/system/dict-data/type', { type })
export const validateReferrerCode = (data: { code: string; channelSource: string }) =>
  httpPost('/app-api/member/user-auth-info/referrer-validate-code', {}, data)
export const createUserAuthInfo = (
  data: Partial<{
    id: number
    userId: number
    designerName: string
    gender: number
    mobile: string
    channelSource: number
    referrer: string
    employer: string
    spatialExpertiseType: number
    attachment: string
    auditStatus: number
    remark: string
  }>,
) => httpPost<any>('/app-api/member/user-auth-info/create', data)
/**
 * 获取设计师基本信息
 */
export const getUserBasicInfo = (query: { userId: string }) =>
  httpGet<UserBasicInfo>('/app-api/member/stylist-basic-info/get', query)
/**
 * 更新设计师基本信息
 */
export const updateUserBasicInfo = (data: Partial<UserBasicInfo>) =>
  httpPut('/app-api/member/stylist-basic-info/update', data)
/**
 * 获取设计师审核信息
 */
export const getUserAuthInfo = () => httpGet<UserAuthInfo>('/app-api/member/user-auth-info/get')
/**
 * 更新设计师审核信息
 */
export const updateUserAuthInfo = (data: Partial<UserAuthInfo>) =>
  httpPost('/app-api/member/user-auth-info/update', data)
export const getCircles = (query: { tagName?: string; circleType?: string; stylistId?: string }) =>
  httpGet<{
    list: {
      id: number
      headUrl?: string
      stylistId?: number
      stylistName?: string
      marketing?: string
      circleDesc?: string
      tagName?: string
      detailsType?: string
      detailsUrl?: string
      detailsDesc?: string
      circleType?: string
      spaceType?: string
      designStyle?: string
      spaceAddr?: string
      customerDemand?: string
      createTime: number
      bannerUrls: string[]
      shareCount?: number
      upvoteCount?: number
      ownUpvote: boolean
      reviewCount: number
    }[]
  }>('/app-api/member/circle/page', query)
export const createCircle = (data: Partial<Circle>) =>
  httpPost<any>('/app-api/member/circle/create', data)
export const getCircle = (id: string) =>
  httpGet<Partial<CircleRes>>('/app-api/member/circle/get', { id })
/**
 * 删除个人圈子
 */
export const deleteCircle = (id: string) => httpDelete('/app-api/member/circle/delete', { id })
export const shareCircle = (id: string) => httpGet('/app-api/member/circle/share', { id })
/**
 * /app-api/member/designer/shareHomeHistory 分享设计师主页
 */
export const shareDesignerHome = (data: {
  stylistId: number
  bizId: number
  // shareType:
}) => httpPost('/app-api/member/designer/shareHomeHistory', data)
export const getCircleUpvotes = (id) =>
  httpGet<{
    total: number
    list: {
      id: number
      circleId: number
      userId: number
      upvpteTime: number
      createTime: number
      userName: string
    }[]
  }>('/app-api/member/circle-upvote/page', { circleId: id })
export const createCircleUpvote = (data: { circleId: number; userId: number; userName: string }) =>
  httpPost('/app-api/member/circle-upvote/create', data)
/**
 * 取消圈子点赞
 */
export const cancelCircleUpvote = (query: { id: string }) =>
  httpGet('/app-api/member/circle-upvote/delete', query)
export const createCircleReview = (
  data: Partial<{
    circleId: string
    userId: string | number
    userName: string
    reviewContent: string
    replayReviewId: string
  }>,
) => httpPost<any>('/app-api/member/circle-review/create', data)
export const deleteCircleReview = (id) => httpGet('/app-api/member/circle-review/delete', { id })
export const getCircleReviews = (query: { circleId: string }) =>
  httpGet<{
    list: Comment[]
  }>('/app-api/member/circle-review/getCircleReviewByCircleId', query)
/**
 * 获取圈子评论回复
 */
export const getCircleReviewReplaies = (query = {}) =>
  httpGet<any>('/app-api/member/circle-review/getReviewReplay', query)
export const createCircleReviewUpvote = (data: {
  circleId: number
  userId: number
  userName: string
  reviewId: number
}) => httpPost('/app-api/member/circle-review-upvote/create', data)
export const cancelCircleReviewUpvote = (query: {
  circleId: string
  userId: string
  reviewId: string
}) => httpGet('/app-api/member/circle-review-upvote/cancel', query)
export const getCircleReviewUpvotes = (query: { circleId: string; reviewId?: string }) =>
  httpGet('/app-api/member/circle-review-upvote/page', query)
export const getReviewReplay = (query: { id: string }) =>
  httpGet('/app-api/member/circle-review/getReviewReplay', query)
export const getTasks = (query) =>
  httpGet<{
    list: {
      id: number
      taskKey: string
      taskValue: string
      createTime: string
      sort: number
      status: number
    }[]
  }>('/app-api/basicsetting/set-task-center/page', query)
/**
 * 获取发布圈子任务状态
 */
export const getCircleTaskStatus = () => httpGet('/app-api/member/circle/taskIntegral')
export const getCircleTags = (query) =>
  httpGet<{
    list: {
      id: number
      labelName: string
      labelType: number
      usageCount: number
      creator: string
      createTime: number
    }[]
  }>('/app-api/basicsetting/set-label/page', query)
/**
 * 获取用户标签
 */
export const getMemberTags = (query: { stylistId: string }) =>
  httpGet<
    {
      id: number
      stylistId: number
      stylistName: string
      tagName: string
      createTime: string
    }[]
  >('/app-api/member/circle/pageUerTag', query)
/**
 * 创建用户标签
 */
export const createMemberTag = (
  data: Partial<{
    stylistId: number
    stylistName: string
    tagName: string
  }>,
) => httpPost('/app-api/member/circle/createUserTag', data)
/**
 * 删除用户标签
 */
export const deleteMemberTag = (id: string) =>
  httpDelete('/app-api/member/circle/deleteUserTag', { id })
export const getSetIndexConfigs = (query = {}) =>
  httpGet<{
    list: {
      id: number
      name: string
      indexPromotionalVideoImage: string
      coverVideoImage: string
      sort: number
      playCount: number
      status: number
      createTime: string
    }[]
  }>('/app-api/basicsetting/set-index-config/page', query)
export const updateSetIndexConfig = (data: { id: number; status: number }) =>
  httpPut('/app-api/basicsetting/set-index-config/update', data)

/**
 * 获取材料商列表
 * @param query {{brandLevel: '1'|'2'}}
 * @returns {Promise<*>}
 */
export const getMaterials = (query = {}) =>
  httpGet<{
    list: MaterialDealer[]
  }>('/app-api/member/materials/page', query)
export const getAppMaterials = () =>
  httpGet<MaterialDealerRes[]>('/app-api/member/materials/appMaterialsList')
export const getAppMaterial = (id: number) =>
  httpGet<MaterialDealer>('/app-api/member/materials/queryHomePage', { materialsId: id })
export const getMaterialHomePage = (id: number) =>
  httpGet<Partial<MaterialDealerHomePage>>('/app-api/member/materials/queryHomePage', {
    materialsId: id,
  })
export const getMaterialDetail = (query: { id: string }) =>
  httpGet<MaterialDealer>('/app-api/member/materials/getDetail', query)
/**
 * 下载材料商
 */
export const downloadMaterials = (query: { materialsId: string }) =>
  httpGet('/app-api/member/materials/download', query)
export const createMaterialsReferrer = (data) =>
  httpPost('/app-api/member/materials-referrer/create', data)
export const getContents = (query: {
  contentType?: '1' | '2' | '3'
  contentCategory?: string
  pageSize?: string
}) => httpGet<{ list: Content[] }>('/app-api/member/content-manger/page', query)
export const getAllCategories = () =>
  httpGet<Category[]>('/app-api/member/categories/getAllCategories')
export const getContent = (query: { id: string }) =>
  httpGet<Content>('/app-api/member/content-manger/get', query)
export const getProductCategories = () =>
  httpGet<Category[]>('/app-api/member/product-type/getAllProductCategories', {})
export const getProducts = (query: { oneCategory?: string; secondCategory?: string }) =>
  httpGet<{
    list: {
      prodcutName: string
      productId: string
      needPoints: number
      points: number
      productPrice: string
      productCoverImgUrl: string
      productDetailsImgUrl: string
      contentDesc: string
      productType: string
      oneCategory: any
      secondCategory: string
    }[]
  }>('/app-api/member/product/page', query)
/**
 * 获取超值划算商品
 */
export const getFavourableProducts = () =>
  httpPost<Product[]>('/app-api/member/product/listFavourableProduct')
export const getProduct = (id: string) =>
  httpGet<Product>('/app-api/member/product/detail', { productId: id })
export const getProductItemBuy = (query: { userId: number }) =>
  httpPost<{
    list: Partial<{
      productId: string
      prodcutName: string
      oneCategory: any
      secondCategory: string
      isRestrict: number
      productRepertory: any
      productPrice: string
      productType: string
      vendorId: any
      vendorName: string
      needPoints: number
      points?: number
      gainType: number
      exchangeDesc: any
      productCoverImgUrl: string
      productDetailsImgUrl: string
      contentDesc: string
      status: number
      exchangeCount: any
      memberLevelId: any
      memberLevelName: any
      favourablePoints?: number
      favourableEndDate?: number
      favourableStatus: number
      count: number
      createTime: any
      userId: number
      nums: number
      deleted?: boolean
    }>[]
    total: number
  }>('/app-api/member/product-item-buy/select', query)
/**
 * 商品添加到购物车
 */
export const createProductItemBuy = (data: {
  doList: {
    createTime?: string
    updateTime?: string
    creator?: string
    updater?: string
    deleted?: boolean
    id?: number
    productId?: string
    userId?: number
    points: number
    nums: number
  }[]
}) => httpPost('/app-api/member/product-item-buy/create', data)
/**
 * 从购物车删除商品
 */
export const deleteProductItemBuy = (data: {
  doList: {
    createTime?: string
    updateTime?: string
    creator?: string
    updater?: string
    deleted?: boolean
    id?: number
    productId?: string
    userId?: number
    nums?: number
  }[]
}) => httpPost('/app-api/member/product-item-buy/delete', data)
/**
 * 购物车商品数量增减
 */
// export const updateProductItemNums = (data: {
//   userId: number
//   productId: string
//   changingNum: number
// }) => httpPost('/app-api/member/product-item-buy/increase-or-decrease/product/num', data)
/**
 * 商城下单
 */
export const productPlacing = (data: {
  isShoppingCart: number
  userId: number
  /**
   * 1-游学项目,2-线下活动,3-品质商城,4-案例拍摄,5-微信代运营,6-积分支付,7-其他
   */
  item: number | 1 | 2 | 3 | 4 | 5 | 6 | 7
  list: {
    orderNo?: string
    productId?: string
    points?: number
    nums?: number
    productName: string
    orderImgUrl: string
    /**
     * 商家id
     */
    vendorId: string | number
  }[]
  couponList: {
    couponId: number
    brandPoints: number
  }[]
  totalsPoints?: number
  totalsCouponPoints?: number
  totalsCurrPoints?: number
}) => httpPost('/app-api/member/points-order/placing', data)
/**
 * 获取订单金额
 */
export const getOrderAmount = (data: {
  isShoppingCart: number
  userId: number
  list: {
    orderNo?: string
    productId?: string
    points?: number
    nums?: number
  }[]
  couponList: {
    couponId: number
    brandPoints: number
  }[]
  totalsPoints?: number
  totalsCouponPoints?: number
  totalsCurrPoints?: number
}) => httpPost<ConfirmOrder>('/app-api/member/points-order/orderAmount', data)
/**
 * 订单结算
 */
export const orderPay = (data: {
  isShoppingCart: number
  userId: number
  list: {
    orderNo?: string
    productId?: string
    points?: number
    nums?: number
  }[]
  couponList: {
    couponId: number
    brandPoints: number
  }[]
  totalsPoints?: number
  totalsCouponPoints?: number
  totalsCurrPoints?: number
}) => httpPost(`/app-api/member/points-order/placingPay`, data)
/**
 * 积分结账
 */
export const pointsPay = (data: {
  userId: number
  points: number
  vendorId: number
  orderMoney?: number
}) => httpPost('/app-api/member/points-order/orderAndPaymentCompleted', data)
export const getPointsOrders = (query) =>
  httpGet<{
    list: PointsOrder[]
    total: number
  }>('/app-api/member/points-order/page', query)
export const getPointsOrder = (id) =>
  httpGet<Partial<PointsOrder>>('/app-api/member/points-order/get', { id })
/**
 * 取消订单
 */
export const cancelOrder = (id) => httpGet('/app-api/member/points-order/orderCancel', { id })
export const getActivities = (query) =>
  httpGet<{
    list: Activity[]
  }>('/app-api/member/activity/page', query)
export const getActivity = (id: string) =>
  httpGet<Partial<Activity>>('/app-api/member/activity/get', { id })
export const activitySignup = (data: { id: number }) =>
  httpPost('/app-api/member/activity/signup', data)
/**
 * 获取活动报名列表
 */
export const getActivitySignups = (query: { activityId: string; pageSize?: number }) =>
  httpGet<ResPageData<ActivitySignUp>>('/app-api/member/activity/signup/page', query)
/**
 * 获取游学列表
 */
export const getStudyTours = (query) =>
  httpGet<{ list: StudyTour[]; total: number }>('/app-api/member/app-study-abroad/page', query)
/**
 * 获取游学详情
 */
export const getStudyTour = (id: string) =>
  httpGet<StudyTour>('/app-api/member/app-study-abroad/get', { id })
/**
 * 游学报名
 */
export const studyTourSignup = (data: { id: number }) =>
  httpPost('/app-api/member/app-study-abroad/signup', data)
/**
 * 获取游学报名列表
 */
export const getStudyTourSignups = (query: { studyId: string; pageSize?: number }) =>
  httpGet<ResPageData<ActivitySignUp>>('/app-api/member/app-study-abroad/signup/page', query)
/**
 * 获取游学或活动的照片列表
 * @param query {{bizId: string; bizType: '1'|'2'}} bizId: 游学或活动id, bizType: 2-游学, 1-活动
 */
export const getPhotoList = (query: { bizId: string; bizType: '1' | '2'; pageSize?: number }) =>
  httpGet<
    ResPageData<{
      id: number
      bizId: number
      bizType: string
      bizTypeName: string
      travelDate: string
      video: any[]
      picture: any[]
      createTime: string
    }>
  >('/app-api/member/app-study-abroad/pageStudyActivityPhoto', query)
/**
 * 获取Banner列表
 */
export const getBanners = (query: { mode: BannerMode }) =>
  httpGet<Banner[]>('/app-api/member/banner/get-by-mode', query)
/**
 * 获取消息列表
 */
export const getMessages = (query) =>
  httpGet<ResPageData<Message>>('/app-api/member/message-manage/page', query)
/**
 * 删除消息
 */
export const deleteMessage = (id: string) =>
  httpPost('/app-api/member/message-manage/delete', {}, { id })
/**
 * 更新消息
 */
export const updateMessage = (data: Partial<Message>) =>
  httpPut('/app-api/member/message-manage/update', data)
/**
 * 积分订单取消
 */
export const orderPointsCancel = (query: { id: string; cancelReason: string }) =>
  httpGet('/app-api/member/points-details/points-cancel', query)
/**
 * 积分订单确认
 */
export const orderPointsSubmit = (data: { id: number; userId: number; couponUserId: number }) =>
  httpPost('/app-api/member/points-details/confirm', data)
/**
 * 获取Banner
 */
export const getBanner = (id) => httpGet<Banner>('/app-api/member/banner/get-by-id', { id })
/**
 * 获取积分明细列表
 */
export const getPoints = (query) =>
  httpGet<{
    list: {
      id: number
      pointsType: string
      typeName: string
      pointsCategory: string
      categoryName: string
      sourceId: number
      name: string
      pointsStauts: string
      points: number
      orderMoney: string
      materialsId: number
      materialsBrand: string
      stylistId: number
      brokerId: number
      stylistName: string
      brokerName: string
      generateTime: string
      verifyTime: string
      completeTime: string
      turnDownTime: string
      cancelTime: string
      cancelReason: string
      turnDownReason: string
      remark: string
      couponId: number
      orderNo: string
      createTime: string
    }[]
    total: number
  }>(`/app-api/member/points-details/pageAllByYear/${query.year}`, query)
/**
 * 获取会员等级列表
 */
export const getMemberLevels = () =>
  httpGet<
    {
      id: number
      memberLevel: number
      memberLevelName: string
      upgradeCriteria: number
      points: number
      retentionDaysCriteria: number
      retentionDays?: number
      memberBgImage: string
      associatedMemberRights: string
      associatedMemberRightsName: any
      status: number
      createTime: number
    }[]
  >('/app-api/basicsetting/set-member-level-config/list')
/**
 * 获取设计师信息
 */
export const getDesignerInfo = (userId) =>
  httpGet<
    Partial<{
      id: number
      userId: number
      brokerId: number
      brokerName: string
      status: string
      authTime: number
      points: number
      homePageName?: string
      headImgUrl: string
      shareCount: number
      viewCount: number
      winCustomerCount: number
      serviceYears: string
      serviceCustomerCount: number
      designFee: string
      memberValidTime: number
      personalIdentity: string
      designDesc: string
      followFocus: string
      homePageUrl: string
      sharePageUrl: string
      retryStatus: number
      videoNumber: string
    }>
  >('/app-api/member/designer/getDesignerInfo', { userId })
/**
 * 更新设计师信息
 */
export const updateDesignerInfo = (data) =>
  httpPost<any>('/app-api/member/designer/updateDesignerInfo', data)
/**
 * 预约设计师
 */
export const reserveDesigner = (data: {
  stylistId: number
  stylistName: string
  appointmentName: string
  appointmentPhone: string
}) => httpPost<any>('/app-api/member/designer/reserveDesigner', data)
/**
 * 本年获客统计
 */
export const countThisYear = (data: { year: number; userId: number }) =>
  httpPost<
    {
      bizType: string
      quantity: number
    }[]
  >('/app-api/member/designer/countThisYear', data)
/**
 * 创建设计师主页浏览记录
 */
export const createBrowseHistory = (data: {
  stylistId: number
  /**
   * 业务id
   */
  bizId?: string
  /**
   * 业务类型,可用值:分享,获客,浏览 [1,2,3]
   */
  bizType?: string | number
  /**
   * 时长：单位-秒
   */
  duration?: string
}) => httpPost('/app-api/member/designer/browseHistory', data)
/**
 * 浏览记录
 */
export const createBrowseRecord = (data: any) =>
  httpPost('/app-api/member/browse-record/create', data)
export const getBrowseHistories = (query) =>
  httpGet<
    ResPageData<{
      createTime: number
      updateTime: number
      creator: string
      updater: string
      deleted: boolean
      id: number
      stylistId: number
      stylistName: string
      bizId: any
      bizType: number
      duration: string
      creatorName: string
    }>
  >('/app-api/member/designer/getBrowseHistory', query)
/**
 * 获取获客记录
 */
export const getReserveHistory = (query) =>
  httpGet<
    ResPageData<{
      id: number
      stylistId: number
      stylistName: string
      appointmentName: string
      appointmentPhone: string
      appointmentTime: string
      createTime: string
    }>
  >('/app-api/member/designer/getReserveHistory', query)
/**
 * 通过ID获取用户信息
 */
export const getUserInfoById = (id) =>
  httpGet<
    Partial<{
      mobile: string
      status: string
      nickname: string
      avatar: string
      name: string
      sex: string
      areaId: number
      areaName: string
      birthday: string
      mark: string
      tagIds: string
      levelId: number
      groupId: number
      id: number
      registerIp: string
      loginIp: string
      loginDate: string
      createTime: string
      point: number
      totalPoint: number
      tagNames: string
      levelName: string
      groupName: string
      experience: number
    }>
  >('/app-api/member/user/getByUserId', { id })
/**
 * 获取会员等级配置
 */
export const getAppMemberLevelConfigs = () =>
  httpGet<
    {
      id: number
      memberLevel: number
      memberLevelName: string
      upgradeCriteria: number
      points: number
      retentionDaysCriteria: number
      retentionDays: number
      memberBgImage: string
      associatedMemberRights: string
      associatedMemberRightsName: string
      status: number
      createTime: string
      logo: string
      setMemberRights: {
        createTime: string
        updateTime: string
        creator: string
        updater: string
        deleted: boolean
        id: number
        rightsName: string
        rightsType: number
        rightsImage: string
        rightsDescription: string
        associatedMemberRightsLevel: string
        status: number
      }[]
    }[]
  >('/app-api/basicsetting/app-set-member-level-config/listAndRights')
/**
 * 到店打卡
 */
export const storeAndPunchIn = (data: { id: number }) =>
  http<boolean>({
    url: '/app-api/member/user-auth-info/storeAndPunchIn',
    data,
    hideErrorToast: true,
    method: 'POST',
  })
/**
 * 获取优惠券
 */
export const getCoupons = (query) =>
  httpGet<ResPageData<Coupon>>('/app-api/member/coupon-user/page', query)
/**
 * 获取商品优惠券
 */
export const getProductCoupons = (query) =>
  httpGet<Coupon[]>('/app-api/member/coupon-user/coupon-user-by-product-ids-page', query)
/**
 * 获取积分券
 */
export const getPointsCoupons = (query) =>
  httpGet<Coupon[]>('/app-api/member/coupon-user/coupon-user-by-point-ids-page', query)
/**
 * 获取已报名的游学
 */
export const getMyStudyTours = (query = {}) =>
  httpGet<MyStudyTour[]>('/app-api/member/app-study-abroad/getSignUpStudyAbroad', query)
/**
 * /app-api/member/stylist-honor/updatePopUp 更新弹窗
 */
export const updateHonorPopUp = (query: { bizId: string; bizType: string }) =>
  httpGet('/app-api/member/stylist-honor/updatePopUp', query)
/**
 * 获取徽章列表
 */
export const getBadges = (query = {}) =>
  httpGet<{ [key: string]: Badge[] }>('/app-api/member/stylist-honor/get-badge-list', query)
/**
 * 获取个人徽章
 */
export const getOwnBadges = (query = {}) =>
  httpGet<Badge[]>('/app-api/member/stylist-honor/getConferBadgeList', query)
/**
 * 获取证书列表
 */
export const getCertificates = (query = {}) =>
  httpGet<Certificate[]>('/app-api/member/stylist-honor/get-certificate-list', query)
/**
 * 获取荣誉统计
 */
export const getHonorStatistics = (query = {}) =>
  httpGet<{
    certCount: number
    badgeCount: number
  }>('/app-api/member/stylist-honor/get-honor-count', query)
/**
 * 获取骑行下拉
 */
export const getRidingOptions = () =>
  httpGet<
    {
      id: string
      name: string
    }[]
  >('/app-api/member/app-riding/listFinishedRidingActivity')
/**
 * 获取骑行数据
 */
export const getRidings = (query) =>
  httpGet<
    ResPageData<{
      memberStylistName: string
      avatar: string
      radeKmTotal: string
    }>
  >('/app-api/member/app-riding/page', query)
/**
 * 获取客服列表
 */
export const getAgents = () =>
  httpGet<
    {
      id?: number
      brokeId?: string
      headImgUrl: string
      brokerName: string
      password?: string
      mobile: string
      status?: number
      channelType?: number
      designersNumber: any
      yearPoints: any
      yearOrders: any
      createTime?: number
      inviteCode?: string
      customer: number
      customerName: string
    }[]
  >('/app-api/member/user/getCustomerServiceList')
export const fakeThis = (query: { agreement: AgreementType }) =>
  httpGet<string>('/app-api/infra/file/download', query)
export const fuckYouMom = (query: { id: string }) =>
  httpGet('/app-api/member/message-manage/get', query)
export const fuckYou = (data: { id: number }) =>
  httpPost('/app-api/member/message-manage/isRead', data)
export const refreshToken = (refreshToken: string) =>
  httpPost<any>('/app-api/member/auth/refresh-token', {}, { refreshToken })
export const httpGetMock = <T>(data: T) =>
  new Promise<IResData<T>>((resolve) => resolve({ code: 1, msg: '', data } as IResData<T>))
export interface Circle {
  headUrl: string
  stylistId: string | number
  stylistName: string
  marketing: string
  circleDesc: string
  tagName: string
  detailsType: string
  detailsUrl: string
  detailsDesc: string
  circleType: string
  spaceType: string
  designStyle: string
  spaceAddr: string
  customerDemand: string
  bannerUrls: string[]
  tagIds?: number[]
}
export interface CircleRes {
  id: number
  headUrl?: string
  stylistId?: number
  stylistName?: string
  marketing?: string
  circleDesc?: string
  tagName?: string
  detailsType?: string
  detailsUrl?: string
  detailsDesc?: string
  circleType?: string
  spaceType?: string
  designStyle?: string
  spaceAddr?: string
  customerDemand?: string
  createTime: number
  bannerUrls: string[]
  shareCount?: number
  upvoteCount?: number
  ownUpvote: boolean
  reviewCount: number
  caseName?: string
  spaceExtent?: string
  levelId?: number
}
