// src/api/deal/dealApi.ts
import instance from "../axiosInstance"
import type { DealCard } from "../../models/deal/DealCard"
import type { DealDetail } from "../../models/deal/DealDetail"

export async function getDeals(page = 1): Promise<DealCard[]> {
  const { data } = await instance.get<{ results: DealCard[] }>(
    `/deals?page=${page}`
  )
  console.log(data.results)
  return data.results
}
export async function getDealDetail(id: number): Promise<DealDetail> {
  const { data } = await instance.get<DealDetail>(`/deals/${id}`)
  return data
}
