import { orderBookingClient } from '../../api/clients';
import { ORDER_BOOKING } from '../../api/config';
import { RecordView } from './RecordView';

export interface WiredRecordViewProps {
  onRowClick?: (row: Record<string, unknown>, index: number) => void;
  pageSize?: number;
  headerActions?: React.ReactNode;
  rowActions?: (row: Record<string, unknown>) => React.ReactNode;
  refreshKey?: number;
  initialFilters?: Record<string, string>;
  presetAlias?: string;
}

/** Orders record view (Order Booking workflow). */
export function OrdersView({ onRowClick, pageSize, headerActions, rowActions, refreshKey, initialFilters, presetAlias }: WiredRecordViewProps) {
  return (
    <RecordView
      client={orderBookingClient}
      rvUid={ORDER_BOOKING.recordViews.ORDERS}
      title="Orders"
      onRowClick={onRowClick}
      pageSize={pageSize}
      headerActions={headerActions}
      rowActions={rowActions}
      refreshKey={refreshKey}
      sortBy="created_at"
      sortDir="desc"
      omitColumns={['created_at', 'instance_id']}
      initialFilters={initialFilters}
      presetAlias={presetAlias}
    />
  );
}
