export function identifyLinkType(url: string, throwException = true) {
  if (!url) {
    throw new Error('URL is required.');
  }

  if (!/data\.ai/.test(url)) {
    if (throwException) {
      throw new Error("Invalid URL. The URL must contain 'data.ai'.");
    } else {
      console.error('Here...Data.ai');
    }
  }

  if (
    /\/apps\/(ios|android|google-play|amazon-appstore|mac)\/app\//i.test(url)
  ) {
    return 'appLink';
  } else if (
    /\/apps\/(ios|android|google-play|amazon-appstore|mac)\/publisher\//i.test(
      url,
    )
  ) {
    return 'publisherLink';
  } else if (/\/company\//i.test(url)) {
    return 'companyLink';
  } else {
    return '';
  }
}
