/**
 * Shared schema.org helpers — prevents property drift across pages that embed
 * the same structured-data type with different (or missing) fields.
 */

export function softwareApplicationBase(name: string) {
  return {
    '@type': 'SoftwareApplication' as const,
    name,
    applicationCategory: 'BusinessApplication',
    operatingSystem: 'Web',
  };
}

export interface BreadcrumbItem {
  name: string;
  url: string;
}

export function breadcrumbListSchema(items: BreadcrumbItem[]) {
  return {
    '@context': 'https://schema.org',
    '@type': 'BreadcrumbList' as const,
    itemListElement: items.map((item, index) => ({
      '@type': 'ListItem' as const,
      position: index + 1,
      name: item.name,
      item: item.url,
    })),
  };
}
