import { request } from '@/utils/request'
import type {
  EventItem,
  EventListParams,
  MyEventItem,
  JoinEventResponse,
  ApiResponse,
} from './type'

/** 获取活动列表 */
export const getEventListAPI = (params: EventListParams) =>
  request.post<ApiResponse<EventItem[]>>('/event/list', params)

/** 参加活动 */
export const joinEventAPI = (id: string) =>
  request.get<ApiResponse<JoinEventResponse>>(`/event/join/${id}`)

/** 获取我参加的活动列表 */
export const getMyEventListAPI = () => request.get<ApiResponse<MyEventItem[]>>('/event/myEvent')
