import apiClient from './client';
import type { TradeSetup } from '../lib/types';

export interface TradeListParams {
  direction?: 'long' | 'short';
  min_confidence?: number;
  recommended_action?: 'LONG_HIGH' | 'LONG_MODERATE' | 'SHORT_HIGH' | 'SHORT_MODERATE' | 'NEUTRAL';
}

export function list(params?: TradeListParams) {
  return apiClient.get<TradeSetup[]>('trades', { params }).then((r) => r.data);
}

export function bySymbol(symbol: string) {
  return apiClient.get<TradeSetup[]>(`trades/${symbol.toUpperCase()}`).then((r) => r.data);
}

export function history(symbol: string) {
  return apiClient.get<TradeSetup[]>(`trades/${symbol.toUpperCase()}/history`).then((r) => r.data);
}
