// [nexus] API client for puter-proxy, oauth/google, and api-keys endpoints
import { api } from "./client";

export const puterProxyApi = {
  /** Store Puter token server-side after company creation */
  storeToken: (companyId: string, token: string) =>
    api.post("/puter-proxy/token", { companyId, token }),

  /** Get Google OAuth authorization URL and stateId — no companyId needed (pre-company) */
  getAuthUrl: () =>
    api.post<{ url: string; stateId: string }>("/oauth/google/authorize", {}),

  /** Claim Google OAuth tokens for this company after company creation */
  claimGoogleTokens: (stateId: string, companyId: string) =>
    api.post("/oauth/google/claim", { stateId, companyId }),

  /** Store an API key server-side after company creation */
  storeApiKey: (companyId: string, provider: string, apiKey: string) =>
    api.post("/api-keys/store", { companyId, provider, apiKey }),
};
