<?php
/**
 * SEO Configuration File
 * Central configuration for all SEO settings
 * Place in: /config/seo_config.php
 */

// Load SEO Helper
require_once __DIR__ . '/../classes/SEOHelper.php';

// ============================================
// SITE INFORMATION
// ============================================
define('SITE_NAME', 'Esa\'s Fashion');
define('SITE_URL', 'http://localhost/ecoms'); // Change to your domain in production
define('SITE_DESCRIPTION', 'Premium fashion products for women - Quality items at great prices');

// Social Media Handles
define('SOCIAL_FACEBOOK', 'https://www.facebook.com/yourpage');
define('SOCIAL_INSTAGRAM', 'https://www.instagram.com/yourpage');
define('SOCIAL_TWITTER', 'https://www.twitter.com/yourpage');
define('SOCIAL_TWITTER_HANDLE', '@yourhandle');
define('SOCIAL_YOUTUBE', 'https://www.youtube.com/yourchannel');

// Contact Information
define('CONTACT_EMAIL', 'contact@esasfashion.com');
define('CONTACT_PHONE', '+1-XXX-XXX-XXXX');
define('BUSINESS_ADDRESS', 'Your Address, City, State ZIP');

// ============================================
// SEO SETTINGS
// ============================================

// Meta tag length limits
define('META_TITLE_LENGTH', 60); // Optimal: 50-60 characters
define('META_DESCRIPTION_LENGTH', 160); // Optimal: 150-160 characters

// Default meta tags
$DEFAULT_METAS = [
    'title' => SITE_NAME . ' - Premium Fashion for Women',
    'description' => SITE_DESCRIPTION,
    'keywords' => 'fashion, women, clothing, dress, style, trendy, affordable',
    'og_type' => 'website',
    'og_image' => SITE_URL . '/pics_ecom/logo.png'
];

// Page-specific meta tags
$PAGE_METAS = [
    'index' => [
        'title' => 'Premium Fashion Products for Women | Esa\'s Fashion',
        'description' => 'Shop our collection of trendy and affordable fashion products for women. Quality items with fast shipping and easy returns.',
        'keywords' => 'women fashion, clothing, dresses, trends, affordable fashion'
    ],
    'shop' => [
        'title' => 'Shop All Products | Esa\'s Fashion',
        'description' => 'Browse our complete collection of women\'s fashion products. New arrivals, trending styles, and affordable prices.',
        'keywords' => 'shop fashion, women clothing, buy dresses, online shopping'
    ],
    'blogs' => [
        'title' => 'Fashion Blog | Tips, Trends & Style Guides | Esa\'s Fashion',
        'description' => 'Read our latest fashion articles, style tips, and trend guides. Expert advice on women\'s fashion.',
        'keywords' => 'fashion blog, style tips, fashion trends, fashion guide'
    ],
    'cart' => [
        'title' => 'Shopping Cart | Esa\'s Fashion',
        'description' => 'Review and checkout your items. Secure payment and fast delivery.',
        'keywords' => 'shopping cart, checkout, payment'
    ],
    'checkout' => [
        'title' => 'Checkout | Esa\'s Fashion',
        'description' => 'Complete your purchase securely. Multiple payment options available.',
        'keywords' => 'checkout, payment, order'
    ],
    'contact' => [
        'title' => 'Contact Us | Esa\'s Fashion',
        'description' => 'Get in touch with our customer service team. We\'re here to help!',
        'keywords' => 'contact, customer service, support'
    ],
    'about' => [
        'title' => 'About Us | Esa\'s Fashion',
        'description' => 'Learn about Esa\'s Fashion - our mission, values, and commitment to quality.',
        'keywords' => 'about, company, mission, values'
    ]
];

// ============================================
// TECHNICAL SEO SETTINGS
// ============================================

// Sitemap settings
define('SITEMAP_URL', SITE_URL . '/sitemap.php');
define('SITEMAP_INDEX_URL', SITE_URL . '/sitemap_index.php');

// Crawl settings
define('ALLOW_CRAWLERS', true);
define('ROBOTS_TXT_PATH', __DIR__ . '/../robots.txt');

// Performance settings
define('ENABLE_GZIP_COMPRESSION', true);
define('ENABLE_BROWSER_CACHE', true);
define('CACHE_EXPIRY_STATIC', 31536000); // 1 year for images, CSS, JS
define('CACHE_EXPIRY_HTML', 3600); // 1 hour for HTML
define('CACHE_EXPIRY_API', 300); // 5 minutes for API

// ============================================
// SCHEMA MARKUP SETTINGS
// ============================================

$SCHEMA_CONFIG = [
    'organization' => [
        'name' => SITE_NAME,
        'url' => SITE_URL,
        'logo' => SITE_URL . '/pics_ecom/logo.png',
        'description' => SITE_DESCRIPTION,
        'sameAs' => [
            SOCIAL_FACEBOOK,
            SOCIAL_INSTAGRAM,
            SOCIAL_TWITTER
        ],
        'contact' => [
            'type' => 'Customer Service',
            'telephone' => CONTACT_PHONE,
            'email' => CONTACT_EMAIL
        ]
    ],
    
    'product' => [
        'currency' => 'USD',
        'availability' => 'https://schema.org/InStock',
        'condition' => 'https://schema.org/NewCondition'
    ],
    
    'article' => [
        'author' => SITE_NAME,
        'publisher' => SITE_NAME
    ]
];

// ============================================
// KEYWORDS CONFIGURATION
// ============================================

// Primary keywords for your business
$PRIMARY_KEYWORDS = [
    'women fashion',
    'women clothing',
    'trending fashion',
    'affordable fashion',
    'dress online',
    'fashion for women'
];

// Category-specific keywords
$CATEGORY_KEYWORDS = [
    'dresses' => ['women dresses', 'dress online', 'casual dresses', 'formal dresses'],
    'tops' => ['women tops', 'blouses', 'shirts', 'casual tops'],
    'bottom' => ['women bottoms', 'pants', 'jeans', 'skirts'],
    'accessories' => ['fashion accessories', 'bags', 'jewelry', 'scarves'],
    'shoes' => ['women shoes', 'footwear', 'heels', 'casual shoes']
];

// ============================================
// ANALYTICS & TRACKING
// ============================================

// Google Analytics
define('GOOGLE_ANALYTICS_ID', 'G-XXXXXXXXXX'); // Replace with your GA4 ID
define('GOOGLE_ANALYTICS_ENABLED', false); // Set to true in production

// Google Search Console
define('GOOGLE_SEARCH_CONSOLE_VERIFICATION', ''); // Add verification code if needed

// Facebook Pixel
define('FACEBOOK_PIXEL_ID', ''); // Replace with your Pixel ID
define('FACEBOOK_PIXEL_ENABLED', false); // Set to true in production

// Hotjar (heatmaps)
define('HOTJAR_ID', ''); // Replace with your Hotjar ID
define('HOTJAR_ENABLED', false);

// ============================================
// CONTENT OPTIMIZATION
// ============================================

// Minimum content lengths for SEO
define('MIN_PRODUCT_DESCRIPTION_LENGTH', 100);
define('MIN_BLOG_CONTENT_LENGTH', 300);
define('OPTIMAL_BLOG_LENGTH', 1500); // Words

// Image optimization
define('OPTIMIZE_IMAGES', true);
define('IMAGE_LAZY_LOAD', true);
define('IMAGE_WEBP_ENABLED', true);

// Internal linking
define('AUTO_INTERNAL_LINKS', true);
define('RELATED_PRODUCTS_COUNT', 5);
define('RELATED_POSTS_COUNT', 3);

// ============================================
// OFF-PAGE SEO
// ============================================

// Social media sharing
define('ENABLE_SHARE_BUTTONS', true);
define('SHARE_PLATFORMS', ['facebook', 'twitter', 'pinterest', 'whatsapp']);

// Review/Rating integration
define('ENABLE_REVIEWS', true);
define('ENABLE_RATINGS', true);

// ============================================
// SECURITY & HTACCESS
// ============================================

define('ENABLE_HTACCESS', true);
define('BLOCK_BAD_BOTS', true);
define('FORCE_HTTPS', false); // Set to true if you have SSL

// ============================================
// HELPER FUNCTIONS
// ============================================

/**
 * Get page-specific meta tags
 */
function getSeoMetaTags($page = 'index') {
    global $PAGE_METAS, $DEFAULT_METAS;
    return $PAGE_METAS[$page] ?? $DEFAULT_METAS;
}

/**
 * Get category keywords
 */
function getCategoryKeywords($category) {
    global $CATEGORY_KEYWORDS;
    return $CATEGORY_KEYWORDS[$category] ?? [];
}

/**
 * Generate canonical URL
 */
function getCanonicalUrl($path = null) {
    if ($path === null) {
        $path = $_SERVER['REQUEST_URI'];
    }
    // Remove query parameters
    $path = strtok($path, '?');
    return SITE_URL . $path;
}

/**
 * Safe output for meta tags
 */
function safeMeta($text) {
    return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
}

/**
 * Generate pagination links for SEO
 */
function getPaginationLinks($currentPage, $totalPages, $baseUrl) {
    $links = '';
    
    if ($currentPage > 1) {
        $links .= '<link rel="prev" href="' . $baseUrl . '?page=' . ($currentPage - 1) . '">' . "\n";
    }
    
    if ($currentPage < $totalPages) {
        $links .= '<link rel="next" href="' . $baseUrl . '?page=' . ($currentPage + 1) . '">' . "\n";
    }
    
    return $links;
}
?>
