// src/api/deal/createDeal.ts
import instance from "../axiosInstance"

type DealData = {
  title: string
  description?: string
  url?: string
  imageUrl?: string
  customCompany?: string
  price?: number
}

export async function createDeal(dealData: DealData) {
  try {
    const { data } = await instance.post("/deals", dealData)
    return data
  } catch (error: any) {
    const message = error.response?.data?.error || "Fırsat eklenemedi"
    console.error("Fırsat oluşturma hatası:", message)
    throw new Error(message)
  }
}
