import { RemovalMethod, BrokerCategory } from "@shieldai/types";
import type { BrokerEntry } from "./types";

export const BROKER_REGISTRY: BrokerEntry[] = [
  {
    id: "whitepages",
    name: "Whitepages",
    domain: "whitepages.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.MANUAL_FORM,
    removalUrl: "https://www.whitepages.com/optout",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 7,
    isActive: true,
  },
  {
    id: "spokeo",
    name: "Spokeo",
    domain: "spokeo.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.MANUAL_FORM,
    removalUrl: "https://www.spokeo.com/privacy/removal-request",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 14,
    isActive: true,
  },
  {
    id: "truepeoplesearch",
    name: "TruePeopleSearch",
    domain: "truepeoplesearch.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.AUTOMATED,
    removalUrl: "https://www.truepeoplesearch.com/remove-your-info",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 3,
    isActive: true,
  },
  {
    id: "peoplefinders",
    name: "PeopleFinders",
    domain: "peoplefinders.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.MANUAL_FORM,
    removalUrl: "https://www.peoplefinders.com/privacy-policy",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 14,
    isActive: true,
  },
  {
    id: "thatsmth",
    name: "That's Them",
    domain: "thatsmth.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.AUTOMATED,
    removalUrl: "https://thatsmth.com/opt-out",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 7,
    isActive: true,
  },
  {
    id: "fastpeoplesearch",
    name: "FastPeopleSearch",
    domain: "fastpeoplesearch.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.AUTOMATED,
    removalUrl: "https://www.fastpeoplesearch.com/opt-out",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 5,
    isActive: true,
  },
  {
    id: "backgroundcheck",
    name: "BackgroundCheck",
    domain: "backgroundcheck.com",
    category: BrokerCategory.BACKGROUND_CHECK,
    removalMethod: RemovalMethod.MANUAL_FORM,
    removalUrl: "https://www.backgroundcheck.com/removal",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 14,
    isActive: true,
  },
  {
    id: "freepeopledirectory",
    name: "Free People Directory",
    domain: "freepeopledirectory.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.AUTOMATED,
    removalUrl: "https://freepeopledirectory.com/optout",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 7,
    isActive: true,
  },
  {
    id: "radaris",
    name: "Radaris",
    domain: "radaris.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.EMAIL,
    removalUrl: undefined,
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 30,
    isActive: true,
  },
  {
    id: "zynda",
    name: "Zynda",
    domain: "zynda.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.MANUAL_FORM,
    removalUrl: "https://zynda.com/opt-out",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 14,
    isActive: true,
  },
  {
    id: "addressinator",
    name: "Addressinator",
    domain: "addressinator.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.MANUAL_FORM,
    removalUrl: "https://addressinator.com/opt-out",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 14,
    isActive: true,
  },
  {
    id: "familytreenow",
    name: "FamilyTree Now",
    domain: "familytreenow.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.EMAIL,
    removalUrl: undefined,
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 30,
    isActive: true,
  },
  {
    id: "accuratebackground",
    name: "Accurate Background",
    domain: "accuratebackground.com",
    category: BrokerCategory.BACKGROUND_CHECK,
    removalMethod: RemovalMethod.MANUAL_FORM,
    removalUrl: "https://www.accuratebackground.com/optout",
    requiresAccount: true,
    requiresVerification: true,
    estimatedDays: 30,
    isActive: true,
  },
  {
    id: "instantcheckmate",
    name: "Instant Checkmate",
    domain: "instantcheckmate.com",
    category: BrokerCategory.BACKGROUND_CHECK,
    removalMethod: RemovalMethod.MANUAL_FORM,
    removalUrl: "https://www.instantcheckmate.com/opt-out",
    requiresAccount: true,
    requiresVerification: true,
    estimatedDays: 30,
    isActive: true,
  },
  {
    id: "pthree",
    name: "P3 (People Finders)",
    domain: "pthree.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.MANUAL_FORM,
    removalUrl: "https://www.pthree.com/opt-out",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 14,
    isActive: true,
  },
  {
    id: "sortedbee",
    name: "Sorted Bee",
    domain: "sortedbee.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.MANUAL_FORM,
    removalUrl: "https://www.sortedbee.com/opt-out",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 14,
    isActive: true,
  },
  {
    id: "ussearch",
    name: "US Search",
    domain: "ussearch.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.AUTOMATED,
    removalUrl: "https://www.ussearch.com/opt-out",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 7,
    isActive: true,
  },
  {
    id: "tellme",
    name: "Tell me Online Info",
    domain: "tellmeonlineinfo.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.MANUAL_FORM,
    removalUrl: "https://tellmeonlineinfo.com/opt-out",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 14,
    isActive: true,
  },
  {
    id: "synpeople",
    name: "Synpeople",
    domain: "synpeople.com",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.AUTOMATED,
    removalUrl: "https://www.synpeople.com/opt-out",
    requiresAccount: false,
    requiresVerification: true,
    estimatedDays: 7,
    isActive: true,
  },
  {
    id: "atomdata",
    name: "Atom Data",
    domain: "atomdata.xyz",
    category: BrokerCategory.PEOPLE_SEARCH,
    removalMethod: RemovalMethod.EMAIL,
    removalUrl: undefined,
    requiresAccount: false,
    requiresVerification: false,
    estimatedDays: 14,
    isActive: true,
  },
];

export function getBrokerById(id: string): BrokerEntry | undefined {
  return BROKER_REGISTRY.find((b) => b.id === id);
}

export function getActiveBrokers(): BrokerEntry[] {
  return BROKER_REGISTRY.filter((b) => b.isActive);
}

export function getBrokersByCategory(category: string): BrokerEntry[] {
  return BROKER_REGISTRY.filter((b) => b.category === category);
}

export function getBrokersByMethod(method: RemovalMethod): BrokerEntry[] {
  return BROKER_REGISTRY.filter((b) => b.removalMethod === method);
}
