import { apiClient } from './apiClient'

export interface OrderItem {
    product_id: string
    quantity: number
    unit_cents: number
    batch: string
    expires_at: string
}

export interface ShippingAddress {
    recipient_name: string
    street: string
    number: string
    complement?: string
    district: string
    city: string
    state: string
    zip_code: string
    country: string
}

export interface CreateOrderRequest {
    buyer_id: string
    seller_id: string
    items: OrderItem[]
    shipping: ShippingAddress
}

export const ordersService = {
    createOrder: (data: CreateOrderRequest) => {
        return apiClient.post('/v1/orders', data)
    },

    listOrders: () => {
        return apiClient.get('/v1/orders')
    }
}
