// src/services/listingService.ts
import api from './api';
import type { ListingDetail } from '../types/Listing';

export const listingService = {
  getById: async (id: number): Promise<ListingDetail> => {
    const res = await api.get<ListingDetail>(`/listings/${id}`);
    return res.data;
  },
  
  updateStatus: async (id: number, status: string): Promise<void> => {
    await api.put(`/listings/${id}/status`, JSON.stringify(status), {
      headers: { 'Content-Type': 'application/json' }
    });
  }
};