import { lotteryRequest } from "@/lib/lottery-http"; import type { TicketDrawMyMatchPayload, TicketItemDetailPayload, TicketItemsListPayload, } from "@/types/api/ticket-items"; export type GetTicketItemsParams = { page?: number; per_page?: number; draw_no?: string; ticket_no?: string; order_no?: string; number?: string; status?: string[]; start_date?: string; end_date?: string; }; /** `GET /api/v1/ticket/items`(需登录) */ export function getTicketItems( params?: GetTicketItemsParams, ): Promise { return lotteryRequest.get( `/ticket/items`, { params: { page: params?.page, per_page: params?.per_page, draw_no: params?.draw_no, ticket_no: params?.ticket_no, order_no: params?.order_no, number: params?.number, status: params?.status, start_date: params?.start_date, end_date: params?.end_date, }, }, ); } /** `GET /api/v1/ticket/items/{ticket_no}`(需登录) */ export function getTicketItemDetail( ticketNo: string, ): Promise { const enc = encodeURIComponent(ticketNo); return lotteryRequest.get( `/ticket/items/${enc}`, ); } /** `GET /api/v1/ticket/draws/{draw_no}/my-match`(需登录) */ export function getTicketDrawMyMatch( drawNo: string, ): Promise { const enc = encodeURIComponent(drawNo); return lotteryRequest.get( `/ticket/draws/${enc}/my-match`, ); }