import instance from "../axiosInstance"
import type { DealCard } from "../../models/deal/DealCard"


export async function searchDeals(
  query: string,
  page = 1
): Promise<DealCard[]> {
  const { data } = await instance.get<{ results: DealCard[] }>(
    `/deals/`,
    {
      params: { q: query, page },
    }
  )

  return data.results
}