import { apiFetch } from "./auth";

export interface WalletResponse {
  balance: number;
  periodStart: string;
  transactions: Array<{
    id: string;
    amount: number;
    type: string;
    referenceType: string | null;
    referenceId: string | null;
    createdAt: string;
  }>;
}

export interface IdleStatusResponse {
  enabled: boolean;
  playerCount: number | null;
  idleStopAt: string | null;
  secondsRemaining: number | null;
  lastPlayerSeenAt: string | null;
}

export async function getWallet(): Promise<WalletResponse> {
  return apiFetch<WalletResponse>("/account/wallet");
}

export async function getServerIdleStatus(serverId: string): Promise<IdleStatusResponse> {
  return apiFetch<IdleStatusResponse>(`/servers/${serverId}/idle`);
}
