import { Client } from "@hubspot/api-client";

let _client: Client | null = null;

export function getHubSpotClient(): Client {
  if (!_client) {
    const accessToken = process.env.HUBSPOT_API_KEY;
    if (!accessToken) {
      throw new Error("HUBSPOT_API_KEY environment variable is not set");
    }
    _client = new Client({ accessToken });
  }
  return _client;
}
