import { WorkOS } from '@workos-inc/node';

export const workos = new WorkOS(process.env.WORKOS_API_KEY!);

export const clientId = process.env.WORKOS_CLIENT_ID!;

export type OAuthProvider = 'GoogleOAuth' | 'AppleOAuth' | 'GitHubOAuth';

export function getAuthorizationUrl(provider: OAuthProvider) {
  return workos.userManagement.getAuthorizationUrl({
    provider,
    clientId,
    redirectUri: process.env.WORKOS_REDIRECT_URI!,
  });
}

// Get AuthKit hosted login URL (for email/password and phone)
export function getAuthKitUrl() {
  return workos.userManagement.getAuthorizationUrl({
    clientId,
    redirectUri: process.env.WORKOS_REDIRECT_URI!,
  });
}
