import React, { createContext, useContext, useState, ReactNode } from 'react';

export type Language = 'en' | 'tr';

interface LanguageContextType {
  language: Language;
  setLanguage: (lang: Language) => void;
  t: (key: string) => string;
}

const LanguageContext = createContext<LanguageContextType | undefined>(undefined);

export const useLanguage = () => {
  const context = useContext(LanguageContext);
  if (!context) {
    throw new Error('useLanguage must be used within a LanguageProvider');
  }
  return context;
};

interface LanguageProviderProps {
  children: ReactNode;
}

const translations = {
  en: {
    // Navigation
    'nav.home': 'Home',
    'nav.about': 'About',
    'nav.services': 'Services',
    'nav.contact': 'Contact',
    'nav.getStarted': 'Get Started',
    
    // Hero
    'hero.title': 'Mastery. Empathy. Intelligence.',
    'hero.subtitle': 'Bespoke solutions that put people first through our family of specialized brands.',
    'hero.exploreServices': 'Explore Our Services',
    'hero.learnStory': 'Learn Our Story',
    
    // Services Showcase
    'services.title': 'Our Services',
    'services.subtitle': 'Comprehensive solutions designed with empathy and intelligence',
    'services.hr.title': 'Event & Organization Planning',
    'services.hr.description': 'Professional event management and organization planning services for corporate events, conferences, and special occasions.',
    'services.benefits.title': 'Employee Benefits',
    'services.benefits.description': 'Comprehensive benefit packages designed to attract, retain, and motivate your most valuable assets.',
    'services.support.title': 'Personal Support Services',
    'services.support.description': 'Personalized assistant and life management services with custom integration for individuals and organizations.',
    'services.viewAll': 'View All Services',
    
    // Footer
    'footer.company': 'MasterEI Global Inc.',
    'footer.description': 'Creating bespoke human-centered solutions with empathy and intelligence.',
    'footer.address': 'Ferko Signature 175/6 Şişli İstanbul',
    'footer.email': 'info@mastereiglobal.com',
    'footer.followUs': 'Follow us on LinkedIn',
    'footer.copyright': '© 2024 MasterEI Global Inc. All rights reserved.',
    'footer.aboutUs': 'About Us',
    'footer.cookieSettings': 'Cookie Settings',
    
    // About Page
    'about.title': 'About MasterEI Global Inc.',
    'about.mission': 'Our Mission',
    'about.missionText': 'To create bespoke human-centered solutions that bridge the gap between organizational needs and human potential, powered by mastery, empathy, and intelligence.',
    'about.values': 'Our Core Values',
    'about.mastery': 'Mastery',
    'about.masteryText': 'We pursue excellence in everything we do, continuously developing our expertise to deliver outstanding results.',
    'about.empathy': 'Empathy',
    'about.empathyText': 'We understand and share the feelings of others, creating solutions that truly resonate with human needs.',
    'about.intelligence': 'Intelligence',
    'about.intelligenceText': 'We apply strategic thinking and data-driven insights to create innovative solutions for complex challenges.',
    'about.approach': 'Our Approach',
    'about.humanCentered': 'Human-Centered',
    'about.humanCenteredText': 'Every solution we design puts people at the center, ensuring that technology and processes serve human needs.',
    'about.bespoke': 'Bespoke Solutions',
    'about.bespokeText': 'We don\'t believe in one-size-fits-all. Every solution is tailored to your unique challenges and goals.',
    'about.employeeFocus': 'Employee Focus',
    'about.employeeFocusText': 'We help organizations create environments where employees thrive, leading to better business outcomes.',
    
    // Services Page
    'services.page.title': 'Our Services',
    'services.page.subtitle': 'Comprehensive HR solutions designed to transform your workplace',
    'services.page.hrConsulting': 'HR Consulting',
    'services.page.hrDescription': 'Strategic human resources consulting to optimize your workforce, streamline processes, and create exceptional employee experiences that drive business success.',
    'services.page.employeeBenefits': 'Employee Benefits',
    'services.page.benefitsDescription': 'Comprehensive benefit packages designed to attract, retain, and motivate your most valuable assets while ensuring compliance and cost-effectiveness.',
    'services.page.personalSupport': 'Personal Support Services',
    'services.page.supportDescription': 'Personalized support services that demonstrate genuine care for your employees\' wellbeing, from onboarding to career development.',
    'services.page.workplaceWellness': 'Workplace Wellness',
    'services.page.wellnessDescription': 'Holistic wellness programs that promote physical, mental, and emotional health, creating a thriving workplace culture.',
    'services.page.learnMore': 'Learn More',
    'services.page.getStarted': 'Ready to Get Started?',
    'services.page.getStartedText': 'Let\'s discuss how we can help transform your workplace with our human-centered solutions.',
    'services.page.contactUs': 'Contact Us Today',
    
    // Contact Page
    'contact.title': 'Contact Us',
    'contact.subtitle': 'Ready to transform your workplace? Let\'s start the conversation.',
    'contact.form.name': 'Full Name',
    'contact.form.email': 'Email',
    'contact.form.company': 'Company',
    'contact.form.service': 'Service of Interest',
    'contact.form.selectService': 'Select a service',
    'contact.form.message': 'Message',
    'contact.form.messagePlaceholder': 'Tell us about your needs and how we can help...',
    'contact.form.submit': 'Send Message',
    'contact.info.title': 'Contact Information',
    'contact.info.address': 'İstanbul Headquarters',
    'contact.info.addressDetail': 'Ferko Signature 175/6 Şişli İstanbul',
    'contact.info.email': 'Email Us',
    'contact.value.title': 'Why Choose MasterEI Global?',
    'contact.value.expertise': 'Expert team with deep HR industry knowledge',
    'contact.value.solutions': 'Customized solutions tailored to your unique needs',
    'contact.value.support': 'Ongoing support and partnership for long-term success',
    'contact.success': 'Thank you! Your message has been sent successfully.',
    
    // Not Found Page
    'notfound.title': 'Page Not Found',
    'notfound.subtitle': 'The page you\'re looking for doesn\'t exist.',
    'notfound.backHome': 'Back to Home'
  },
  tr: {
    // Navigation
    'nav.home': 'Ana Sayfa',
    'nav.about': 'Hakkımızda',
    'nav.services': 'Hizmetler',
    'nav.contact': 'İletişim',
    'nav.getStarted': 'Başlayın',
    
    // Hero
    'hero.title': 'MasterEI Global — Asistanlık, Etkinlik ve Yaşam Çözümleri',
    'hero.subtitle': 'Bireyler ve kurumlar için kişisel asistanlık ve yaşam yönetimi, kurumsal etkinlik ve organizasyon planlama ile çalışan faydaları çözümleri sunuyoruz.',
    'hero.exploreServices': 'Hizmetlerimizi Keşfedin',
    'hero.learnStory': 'Hikayemizi Öğrenin',
    
    // Services Showcase
    'services.title': 'Hizmetlerimiz',
    'services.subtitle': 'Empati ve zeka ile tasarlanmış kapsamlı çözümler',
    'services.hr.title': 'Etkinlik & Organizasyon Planlama',
    'services.hr.description': 'Kurumsal etkinlikler, konferanslar ve özel günler için profesyonel etkinlik yönetimi ve organizasyon planlama hizmetleri.',
    'services.benefits.title': 'Çalışan Faydaları',
    'services.benefits.description': 'En değerli varlıklarınızı çekmek, tutmak ve motive etmek için tasarlanmış kapsamlı fayda paketleri.',
    'services.support.title': 'Kişisel Destek Hizmetleri',
    'services.support.description': 'Kişi ve kurumlara özel entegrasyon ile kişisel asistan ve yaşam yönetimi hizmetleri.',
    'services.viewAll': 'Tüm Hizmetleri Görüntüle',
    
    // Footer
    'footer.company': 'MasterEI Global Inc.',
    'footer.description': 'Empati ve zeka ile insana odaklı özel çözümler yaratıyoruz.',
    'footer.address': 'Ferko Signature 175/6 Şişli İstanbul',
    'footer.email': 'info@mastereiglobal.com',
    'footer.followUs': 'LinkedIn\'de takip edin',
    'footer.copyright': '© 2024 MasterEI Global Inc. Tüm hakları saklıdır.',
    'footer.aboutUs': 'Hakkımızda',
    'footer.cookieSettings': 'Çerez Ayarları',
    
    // About Page
    'about.title': 'MasterEI Global Inc. Hakkında',
    'about.mission': 'Misyonumuz',
    'about.missionText': 'Organizasyonel ihtiyaçlar ile insan potansiyeli arasındaki boşluğu dolduran, ustalık, empati ve zeka ile desteklenen insana odaklı özel çözümler yaratmak.',
    'about.values': 'Temel Değerlerimiz',
    'about.mastery': 'Ustalık',
    'about.masteryText': 'Yaptığımız her şeyde mükemmelliği hedefliyor, olağanüstü sonuçlar sunmak için uzmanlığımızı sürekli geliştiriyoruz.',
    'about.empathy': 'Empati',
    'about.empathyText': 'Başkalarının duygularını anlıyor ve paylaşıyor, insan ihtiyaçlarına gerçekten uygun çözümler yaratıyoruz.',
    'about.intelligence': 'Zeka',
    'about.intelligenceText': 'Karmaşık zorluklara yenilikçi çözümler yaratmak için stratejik düşünce ve veri odaklı içgörüler uyguluyoruz.',
    'about.approach': 'Yaklaşımımız',
    'about.humanCentered': 'İnsana Odaklı',
    'about.humanCenteredText': 'Tasarladığımız her çözüm insanı merkeze alır, teknoloji ve süreçlerin insan ihtiyaçlarına hizmet etmesini sağlar.',
    'about.bespoke': 'Özel Çözümler',
    'about.bespokeText': 'Herkese uyan tek çözüme inanmıyoruz. Her çözüm benzersiz zorluklarınıza ve hedeflerinize göre özelleştirilir.',
    'about.employeeFocus': 'Çalışan Odağı',
    'about.employeeFocusText': 'Organizasyonların çalışanların geliştiği, daha iyi iş sonuçlarına yol açan ortamlar yaratmasına yardımcı oluyoruz.',
    
    // Services Page
    'services.page.title': 'Hizmetlerimiz',
    'services.page.subtitle': 'İş yerinizi dönüştürmek için tasarlanmış kapsamlı İK çözümleri',
    'services.page.hrConsulting': 'İK Danışmanlığı',
    'services.page.hrDescription': 'İş gücünüzü optimize etmek, süreçleri kolaylaştırmak ve iş başarısını yönlendiren olağanüstü çalışan deneyimleri yaratmak için stratejik insan kaynakları danışmanlığı.',
    'services.page.employeeBenefits': 'Çalışan Faydaları',
    'services.page.benefitsDescription': 'Uyumluluk ve maliyet etkinliği sağlarken en değerli varlıklarınızı çekmek, tutmak ve motive etmek için tasarlanmış kapsamlı fayda paketleri.',
    'services.page.personalSupport': 'Kişisel Destek Hizmetleri',
    'services.page.supportDescription': 'İşe alımdan kariyer gelişimine kadar çalışanlarınızın refahına gerçek özen gösteren kişiselleştirilmiş destek hizmetleri.',
    'services.page.workplaceWellness': 'İşyeri Sağlığı',
    'services.page.wellnessDescription': 'Fiziksel, zihinsel ve duygusal sağlığı destekleyen, gelişen bir işyeri kültürü yaratan bütünsel sağlık programları.',
    'services.page.learnMore': 'Daha Fazla Bilgi',
    'services.page.getStarted': 'Başlamaya Hazır mısınız?',
    'services.page.getStartedText': 'İnsana odaklı çözümlerimizle işyerinizi nasıl dönüştürebileceğimizi konuşalım.',
    'services.page.contactUs': 'Bugün İletişime Geçin',
    
    // Contact Page
    'contact.title': 'İletişim',
    'contact.subtitle': 'İşyerinizi dönüştürmeye hazır mısınız? Konuşmaya başlayalım.',
    'contact.form.name': 'Ad Soyad',
    'contact.form.email': 'E-posta',
    'contact.form.company': 'Şirket',
    'contact.form.service': 'İlgilendiğiniz Hizmet',
    'contact.form.selectService': 'Bir hizmet seçin',
    'contact.form.message': 'Mesaj',
    'contact.form.messagePlaceholder': 'İhtiyaçlarınızı ve size nasıl yardımcı olabileceğimizi bize anlatın...',
    'contact.form.submit': 'Mesaj Gönder',
    'contact.info.title': 'İletişim Bilgileri',
    'contact.info.address': 'İstanbul Merkez',
    'contact.info.addressDetail': 'Ferko Signature 175/6 Şişli İstanbul',
    'contact.info.email': 'E-posta Gönder',
    'contact.value.title': 'Neden MasterEI Global?',
    'contact.value.expertise': 'Derin İK sektörü bilgisine sahip uzman ekip',
    'contact.value.solutions': 'Benzersiz ihtiyaçlarınıza göre özelleştirilmiş çözümler',
    'contact.value.support': 'Uzun vadeli başarı için sürekli destek ve ortaklık',
    'contact.success': 'Teşekkürler! Mesajınız başarıyla gönderildi.',
    
    // Not Found Page
    'notfound.title': 'Sayfa Bulunamadı',
    'notfound.subtitle': 'Aradığınız sayfa mevcut değil.',
    'notfound.backHome': 'Ana Sayfaya Dön'
  }
};

export const LanguageProvider: React.FC<LanguageProviderProps> = ({ children }) => {
  const [language, setLanguage] = useState<Language>('tr');

  const t = (key: string): string => {
    return translations[language][key as keyof typeof translations['en']] || key;
  };

  return (
    <LanguageContext.Provider value={{ language, setLanguage, t }}>
      {children}
    </LanguageContext.Provider>
  );
};