/**
 * Standardized API response types
 */

export interface ApiSuccessResponse<T = any> {
  success: true
  data?: T
  [key: string]: any
}

export interface ApiErrorResponse {
  success: false
  error: {
    code: string
    message: string
    details?: any
  }
}

export type ApiResponse<T = any> = ApiSuccessResponse<T> | ApiErrorResponse

/**
 * Checkout Session API
 */
export interface CheckoutSessionResponse {
  success: true
  order: {
    id: number
    status: string
    total_cents: number
    subtotal_cents: number
    tax_cents: number
    currency: string
    email: string
    items: {
      name: string
      quantity: number
      price_cents: number
      image?: string
    }[]
    shipping_method?: string
    shipping_cost_cents: number
    original_shipping_cents: number
    payment_intent_id?: string
    nonce?: string
  }
}

/**
 * Payment Intent API
 */
export interface PaymentIntentRequest {
  token: string
  billing_address?: {
    first_name: string
    last_name: string
    address_1: string
    address_2?: string
    city: string
    state: string
    postcode: string
    country: string
  }
  shipping_address?: {
    first_name: string
    last_name: string
    address_1: string
    address_2?: string
    city: string
    state: string
    postcode: string
    country: string
  }
}

export interface PaymentIntentResponse {
  success: true
  client_secret: string
  payment_intent_id: string
}

/**
 * Order Status API
 */
export interface OrderStatusResponse {
  success: true
  order_id: number
  paid: boolean
  status: string
}







