/**
 * AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
 *
 * Generated by: scripts/generate-vendor-registry.ts
 * Generated at: 2026-05-21T10:36:13.561Z
 *
 * To regenerate: npm run generate:vendors
 */

import type { VendorTemplate, VendorRegistryEntry, AuthTemplate } from './types.js';
import type { ServiceCategory } from '../../domain/entities/Services.js';

import { awsTemplate } from './templates/aws.js';
import { cloudflareTemplate } from './templates/cloudflare.js';
import { discordTemplate } from './templates/discord.js';
import { slackTemplate } from './templates/slack.js';
import { telegramTemplate } from './templates/telegram.js';
import { twitterTemplate } from './templates/twitter.js';
import { zoomTemplate } from './templates/zoom.js';
import { hubspotTemplate } from './templates/hubspot.js';
import { pipedriveTemplate } from './templates/pipedrive.js';
import { salesforceTemplate } from './templates/salesforce.js';
import { asanaTemplate } from './templates/asana.js';
import { bitbucketTemplate, jiraTemplate, trelloTemplate, confluenceTemplate } from './templates/atlassian.js';
import { githubTemplate } from './templates/github.js';
import { gitlabTemplate } from './templates/gitlab.js';
import { linearTemplate } from './templates/linear.js';
import { mailchimpTemplate, mailgunTemplate, postmarkTemplate, sendgridTemplate } from './templates/email.js';
import { googleTemplate } from './templates/google.js';
import { microsoftTemplate } from './templates/microsoft.js';
import { datadogTemplate, pagerdutyTemplate, sentryTemplate } from './templates/monitoring.js';
import { intercomTemplate, shopifyTemplate, twilioTemplate, zendeskTemplate } from './templates/other.js';
import { paypalTemplate } from './templates/paypal.js';
import { quickbooksTemplate } from './templates/quickbooks.js';
import { rampTemplate } from './templates/ramp.js';
import { stripeTemplate } from './templates/stripe.js';
import { airtableTemplate } from './templates/airtable.js';
import { notionTemplate } from './templates/notion.js';
import { zenrowsTemplate } from './templates/scrape.js';
import { braveSearchTemplate, rapidapiSearchTemplate, serperTemplate, tavilyTemplate } from './templates/search.js';
import { boxTemplate } from './templates/box.js';
import { dropboxTemplate } from './templates/dropbox.js';

/** Complete registry of all vendor templates */
export const vendorRegistry: VendorRegistryEntry[] = [
  {
    id: 'aws',
    name: 'Amazon Web Services',
    serviceType: 'aws',
    category: 'cloud' as ServiceCategory,
    authMethods: ["access-key"],
    credentialsSetupURL: 'https://console.aws.amazon.com/iam/home#/security_credentials',
    template: awsTemplate,
  },
  {
    id: 'cloudflare',
    name: 'Cloudflare',
    serviceType: 'cloudflare',
    category: 'cloud' as ServiceCategory,
    authMethods: ["api-token","global-api-key"],
    credentialsSetupURL: 'https://dash.cloudflare.com/profile/api-tokens',
    template: cloudflareTemplate,
  },
  {
    id: 'discord',
    name: 'Discord',
    serviceType: 'discord',
    category: 'communication' as ServiceCategory,
    authMethods: ["bot-token","oauth-user"],
    credentialsSetupURL: 'https://discord.com/developers/applications',
    template: discordTemplate,
  },
  {
    id: 'slack',
    name: 'Slack',
    serviceType: 'slack',
    category: 'communication' as ServiceCategory,
    authMethods: ["bot-token","oauth-user"],
    credentialsSetupURL: 'https://api.slack.com/apps',
    template: slackTemplate,
  },
  {
    id: 'telegram',
    name: 'Telegram',
    serviceType: 'telegram',
    category: 'communication' as ServiceCategory,
    authMethods: ["bot-token"],
    credentialsSetupURL: 'https://t.me/BotFather',
    template: telegramTemplate,
  },
  {
    id: 'twitter',
    name: 'X (Twitter)',
    serviceType: 'twitter',
    category: 'communication' as ServiceCategory,
    authMethods: ["oauth-user","bearer-token"],
    credentialsSetupURL: 'https://developer.x.com/en/portal/dashboard',
    template: twitterTemplate,
  },
  {
    id: 'zoom',
    name: 'Zoom',
    serviceType: 'zoom',
    category: 'communication' as ServiceCategory,
    authMethods: ["oauth-user","server-to-server"],
    credentialsSetupURL: 'https://marketplace.zoom.us/develop/create',
    template: zoomTemplate,
  },
  {
    id: 'hubspot',
    name: 'HubSpot',
    serviceType: 'hubspot',
    category: 'crm' as ServiceCategory,
    authMethods: ["api-key","oauth-user","oauth-mcp"],
    credentialsSetupURL: 'https://developers.hubspot.com/get-started',
    template: hubspotTemplate,
  },
  {
    id: 'pipedrive',
    name: 'Pipedrive',
    serviceType: 'pipedrive',
    category: 'crm' as ServiceCategory,
    authMethods: ["api-token","oauth-user"],
    credentialsSetupURL: 'https://app.pipedrive.com/settings/api',
    template: pipedriveTemplate,
  },
  {
    id: 'salesforce',
    name: 'Salesforce',
    serviceType: 'salesforce',
    category: 'crm' as ServiceCategory,
    authMethods: ["oauth-user","jwt-bearer"],
    credentialsSetupURL: 'https://login.salesforce.com/lightning/setup/ConnectedApplication/home',
    template: salesforceTemplate,
  },
  {
    id: 'asana',
    name: 'Asana',
    serviceType: 'asana',
    category: 'development' as ServiceCategory,
    authMethods: ["pat","oauth-user"],
    credentialsSetupURL: 'https://app.asana.com/0/developer-console',
    template: asanaTemplate,
  },
  {
    id: 'bitbucket',
    name: 'Bitbucket',
    serviceType: 'bitbucket',
    category: 'development' as ServiceCategory,
    authMethods: ["app-password","oauth-user"],
    credentialsSetupURL: 'https://bitbucket.org/account/settings/app-passwords/',
    template: bitbucketTemplate,
  },
  {
    id: 'github',
    name: 'GitHub',
    serviceType: 'github',
    category: 'development' as ServiceCategory,
    authMethods: ["pat","oauth-user","github-app"],
    credentialsSetupURL: 'https://github.com/settings/developers',
    template: githubTemplate,
  },
  {
    id: 'gitlab',
    name: 'GitLab',
    serviceType: 'gitlab',
    category: 'development' as ServiceCategory,
    authMethods: ["pat","oauth-user"],
    credentialsSetupURL: 'https://gitlab.com/-/profile/personal_access_tokens',
    template: gitlabTemplate,
  },
  {
    id: 'jira',
    name: 'Jira',
    serviceType: 'jira',
    category: 'development' as ServiceCategory,
    authMethods: ["api-token","oauth-3lo"],
    credentialsSetupURL: 'https://id.atlassian.com/manage-profile/security/api-tokens',
    template: jiraTemplate,
  },
  {
    id: 'linear',
    name: 'Linear',
    serviceType: 'linear',
    category: 'development' as ServiceCategory,
    authMethods: ["api-key","oauth-user"],
    credentialsSetupURL: 'https://linear.app/settings/api',
    template: linearTemplate,
  },
  {
    id: 'trello',
    name: 'Trello',
    serviceType: 'trello',
    category: 'development' as ServiceCategory,
    authMethods: ["api-key","oauth-user"],
    credentialsSetupURL: 'https://trello.com/power-ups/admin',
    template: trelloTemplate,
  },
  {
    id: 'mailchimp',
    name: 'Mailchimp',
    serviceType: 'mailchimp',
    category: 'email' as ServiceCategory,
    authMethods: ["api-key","oauth-user"],
    credentialsSetupURL: 'https://admin.mailchimp.com/account/api/',
    template: mailchimpTemplate,
  },
  {
    id: 'mailgun',
    name: 'Mailgun',
    serviceType: 'mailgun',
    category: 'email' as ServiceCategory,
    authMethods: ["api-key"],
    credentialsSetupURL: 'https://app.mailgun.com/settings/api_security',
    template: mailgunTemplate,
  },
  {
    id: 'postmark',
    name: 'Postmark',
    serviceType: 'postmark',
    category: 'email' as ServiceCategory,
    authMethods: ["server-token","account-token"],
    credentialsSetupURL: 'https://account.postmarkapp.com/api_tokens',
    template: postmarkTemplate,
  },
  {
    id: 'sendgrid',
    name: 'SendGrid',
    serviceType: 'sendgrid',
    category: 'email' as ServiceCategory,
    authMethods: ["api-key"],
    credentialsSetupURL: 'https://app.sendgrid.com/settings/api_keys',
    template: sendgridTemplate,
  },
  {
    id: 'google-api',
    name: 'Google',
    serviceType: 'google-api',
    category: 'major-vendors' as ServiceCategory,
    authMethods: ["oauth-user","service-account"],
    credentialsSetupURL: 'https://console.cloud.google.com/apis/credentials',
    template: googleTemplate,
  },
  {
    id: 'microsoft',
    name: 'Microsoft',
    serviceType: 'microsoft',
    category: 'major-vendors' as ServiceCategory,
    authMethods: ["oauth-user","client-credentials"],
    credentialsSetupURL: 'https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade',
    template: microsoftTemplate,
  },
  {
    id: 'datadog',
    name: 'Datadog',
    serviceType: 'datadog',
    category: 'monitoring' as ServiceCategory,
    authMethods: ["api-key"],
    credentialsSetupURL: 'https://app.datadoghq.com/organization-settings/api-keys',
    template: datadogTemplate,
  },
  {
    id: 'pagerduty',
    name: 'PagerDuty',
    serviceType: 'pagerduty',
    category: 'monitoring' as ServiceCategory,
    authMethods: ["api-key","oauth-user"],
    credentialsSetupURL: 'https://support.pagerduty.com/main/docs/api-access-keys',
    template: pagerdutyTemplate,
  },
  {
    id: 'sentry',
    name: 'Sentry',
    serviceType: 'sentry',
    category: 'monitoring' as ServiceCategory,
    authMethods: ["auth-token","oauth-user"],
    credentialsSetupURL: 'https://sentry.io/settings/account/api/auth-tokens/',
    template: sentryTemplate,
  },
  {
    id: 'intercom',
    name: 'Intercom',
    serviceType: 'intercom',
    category: 'other' as ServiceCategory,
    authMethods: ["access-token","oauth-user"],
    credentialsSetupURL: 'https://developers.intercom.com/docs/build-an-integration',
    template: intercomTemplate,
  },
  {
    id: 'shopify',
    name: 'Shopify',
    serviceType: 'shopify',
    category: 'other' as ServiceCategory,
    authMethods: ["access-token","oauth-user"],
    credentialsSetupURL: 'https://partners.shopify.com/',
    template: shopifyTemplate,
  },
  {
    id: 'twilio',
    name: 'Twilio',
    serviceType: 'twilio',
    category: 'other' as ServiceCategory,
    authMethods: ["api-key","api-key-sid"],
    credentialsSetupURL: 'https://console.twilio.com/us1/account/keys-credentials/api-keys',
    template: twilioTemplate,
  },
  {
    id: 'zendesk',
    name: 'Zendesk',
    serviceType: 'zendesk',
    category: 'other' as ServiceCategory,
    authMethods: ["api-token","oauth-user"],
    credentialsSetupURL: 'https://support.zendesk.com/hc/en-us/articles/4408889192858',
    template: zendeskTemplate,
  },
  {
    id: 'paypal',
    name: 'PayPal',
    serviceType: 'paypal',
    category: 'payments' as ServiceCategory,
    authMethods: ["oauth-client-credentials"],
    credentialsSetupURL: 'https://developer.paypal.com/dashboard/applications',
    template: paypalTemplate,
  },
  {
    id: 'quickbooks',
    name: 'QuickBooks',
    serviceType: 'quickbooks',
    category: 'payments' as ServiceCategory,
    authMethods: ["oauth-user"],
    credentialsSetupURL: 'https://developer.intuit.com/app/developer/dashboard',
    template: quickbooksTemplate,
  },
  {
    id: 'ramp',
    name: 'Ramp',
    serviceType: 'ramp',
    category: 'payments' as ServiceCategory,
    authMethods: ["oauth-client-credentials","oauth-user"],
    credentialsSetupURL: 'https://app.ramp.com/settings/developer',
    template: rampTemplate,
  },
  {
    id: 'stripe',
    name: 'Stripe',
    serviceType: 'stripe',
    category: 'payments' as ServiceCategory,
    authMethods: ["api-key","oauth-connect"],
    credentialsSetupURL: 'https://dashboard.stripe.com/apikeys',
    template: stripeTemplate,
  },
  {
    id: 'airtable',
    name: 'Airtable',
    serviceType: 'airtable',
    category: 'productivity' as ServiceCategory,
    authMethods: ["pat","oauth-user"],
    credentialsSetupURL: 'https://airtable.com/create/tokens',
    template: airtableTemplate,
  },
  {
    id: 'confluence',
    name: 'Confluence',
    serviceType: 'confluence',
    category: 'productivity' as ServiceCategory,
    authMethods: ["api-token","oauth-3lo"],
    credentialsSetupURL: 'https://id.atlassian.com/manage-profile/security/api-tokens',
    template: confluenceTemplate,
  },
  {
    id: 'notion',
    name: 'Notion',
    serviceType: 'notion',
    category: 'productivity' as ServiceCategory,
    authMethods: ["internal-token","oauth-user"],
    credentialsSetupURL: 'https://www.notion.so/my-integrations',
    template: notionTemplate,
  },
  {
    id: 'zenrows',
    name: 'ZenRows',
    serviceType: 'zenrows',
    category: 'scrape' as ServiceCategory,
    authMethods: ["api-key"],
    credentialsSetupURL: 'https://www.zenrows.com/register',
    template: zenrowsTemplate,
  },
  {
    id: 'brave-search',
    name: 'Brave Search',
    serviceType: 'brave-search',
    category: 'search' as ServiceCategory,
    authMethods: ["api-key"],
    credentialsSetupURL: 'https://brave.com/search/api/',
    template: braveSearchTemplate,
  },
  {
    id: 'rapidapi-search',
    name: 'RapidAPI Web Search',
    serviceType: 'rapidapi-search',
    category: 'search' as ServiceCategory,
    authMethods: ["api-key"],
    credentialsSetupURL: 'https://rapidapi.com/developer/dashboard',
    template: rapidapiSearchTemplate,
  },
  {
    id: 'serper',
    name: 'Serper',
    serviceType: 'serper',
    category: 'search' as ServiceCategory,
    authMethods: ["api-key"],
    credentialsSetupURL: 'https://serper.dev/api-key',
    template: serperTemplate,
  },
  {
    id: 'tavily',
    name: 'Tavily',
    serviceType: 'tavily',
    category: 'search' as ServiceCategory,
    authMethods: ["api-key"],
    credentialsSetupURL: 'https://tavily.com/#api',
    template: tavilyTemplate,
  },
  {
    id: 'box',
    name: 'Box',
    serviceType: 'box',
    category: 'storage' as ServiceCategory,
    authMethods: ["oauth-user","client-credentials"],
    credentialsSetupURL: 'https://developer.box.com/console',
    template: boxTemplate,
  },
  {
    id: 'dropbox',
    name: 'Dropbox',
    serviceType: 'dropbox',
    category: 'storage' as ServiceCategory,
    authMethods: ["oauth-user"],
    credentialsSetupURL: 'https://www.dropbox.com/developers/apps',
    template: dropboxTemplate,
  }
];

/** Map for fast lookup by vendor ID */
const vendorMap = new Map<string, VendorTemplate>(
  vendorRegistry.map((entry) => [entry.id, entry.template])
);

/** Get vendor template by ID */
export function getVendorTemplateById(id: string): VendorTemplate | undefined {
  return vendorMap.get(id);
}

/** Get auth template for a vendor */
export function getAuthTemplate(vendorId: string, authId: string): AuthTemplate | undefined {
  const template = vendorMap.get(vendorId);
  if (!template) return undefined;
  return template.authTemplates.find((a) => a.id === authId);
}

/** List all vendor IDs */
export function listAllVendorIds(): string[] {
  return vendorRegistry.map((entry) => entry.id);
}

/** Get all vendor registry entries */
export function getVendorRegistryEntries(): VendorRegistryEntry[] {
  return [...vendorRegistry];
}

/** Get vendors by category */
export function getVendorsByCategory(category: ServiceCategory): VendorRegistryEntry[] {
  return vendorRegistry.filter((entry) => entry.category === category);
}

/** Get vendors that support a specific auth type */
export function getVendorsByAuthType(authType: 'api_key' | 'oauth'): VendorRegistryEntry[] {
  return vendorRegistry.filter((entry) =>
    entry.template.authTemplates.some((a) => a.type === authType)
  );
}

/** Get all unique categories */
export function getVendorCategories(): ServiceCategory[] {
  return [...new Set(vendorRegistry.map((entry) => entry.category))];
}

/** Total number of vendors */
export const VENDOR_COUNT = 44;
