export const organizationId = 'https://moreminimore.com/#organization';

export function webPageSchema(path: string, name: string, description: string) {
  const url = new URL(path, 'https://moreminimore.com').toString();
  return {
    '@context': 'https://schema.org',
    '@type': 'WebPage',
    '@id': `${url}#webpage`,
    url,
    name,
    description,
    isPartOf: { '@id': 'https://moreminimore.com/#website' },
    about: { '@id': organizationId },
    inLanguage: 'th-TH',
  };
}

export function breadcrumbSchema(items: { name: string; path: string }[]) {
  return {
    '@context': 'https://schema.org',
    '@type': 'BreadcrumbList',
    itemListElement: items.map((item, index) => ({
      '@type': 'ListItem',
      position: index + 1,
      name: item.name,
      item: new URL(item.path, 'https://moreminimore.com').toString(),
    })),
  };
}
