import type { AlqoveClient } from '../client';

export interface SellerBalance {
  available_cents: number;
  pending_cents: number;
  next_payout_date: string; // ISO 8601
  /**
   * Whether Stripe is currently allowing transfers to this store's Connect
   * account. False when onboarding is incomplete or a payout requirement has
   * been flagged. Drives the Connect health banner on /seller and
   * /seller/payouts.
   */
  payouts_enabled: boolean;
  /**
   * Human-readable explanation for why payouts are paused. Null when
   * `payouts_enabled` is true.
   */
  disabled_reason: string | null;
}

export interface SellerBalanceResponse {
  data: SellerBalance;
}

export function createBalanceEndpoints(client: AlqoveClient) {
  return {
    getForStore(storeId: string) {
      return client.get<SellerBalanceResponse>(`/v1/stores/${storeId}/balance`);
    },
  };
}
