// src/api/deal/voteDeal.ts
import instance from "../axiosInstance"
import { endpoints } from "@shared/contracts"

const { votes } = endpoints

export async function voteDeal(dealId: number, type: 1 | 0 | -1) {
  try {
    const { data } = await instance.post("/vote", {
      dealId,
      voteType: type,
    })
    return votes.voteResponseSchema.parse(data)
  } catch (error) {
    console.error("Vote hatası:", error)
    throw error
  }
}
