import { useSEO } from '../composables/useSEO';
import { useStructuredData } from '../composables/useStructuredData';
import { useHead } from '@vueuse/head';

export function useHomeViewSEO() {
  const { addOrganizationSchema, addWebSiteSchema } = useStructuredData();

  // Set page SEO synchronously
  useSEO({
    title: 'Spritesheet Generator - Create Game Spritesheets Online',
    description: 'Free online tool to create spritesheets for game development. Upload sprites, arrange them, and export as a spritesheet with animation preview.',
    url: '/',
    type: 'website',
    keywords: 'spritesheet generator, sprite sheet maker, game development, pixel art, sprite animation, game assets, 2D game tools',
  });

  // Add organization schema
  addOrganizationSchema();

  // Add website schema
  addWebSiteSchema();

  // Add SoftwareApplication schema
  useHead({
    script: [
      {
        type: 'application/ld+json',
        children: JSON.stringify({
          '@context': 'https://schema.org',
          '@type': 'SoftwareApplication',
          name: 'Spritesheet Generator',
          applicationCategory: 'DesignApplication',
          offers: {
            '@type': 'Offer',
            price: '0',
            priceCurrency: 'USD',
          },
          operatingSystem: 'Web Browser',
          description: 'Free online tool to create spritesheets for game development. Upload sprites, arrange them, and export as a spritesheet with animation preview.',
          url: 'https://spritesheetgenerator.online',
          screenshot: 'https://spritesheetgenerator.online/og-image.png',
          featureList: ['Free sprite editor', 'Automatic spritesheet generation', 'Customizable grid layouts', 'Animation preview', 'Cross-platform compatibility', 'Zero installation required', 'Batch processing', 'Multiple export formats (PNG, JPG, GIF, ZIP, JSON)'],
          browserRequirements: 'Requires JavaScript. Requires HTML5.',
          aggregateRating: {
            '@type': 'AggregateRating',
            ratingValue: '4.8',
            ratingCount: '127',
          },
        }),
      },
    ],
  });
}
