import type { Metadata } from 'next';
import { getTranslations, setRequestLocale } from 'next-intl/server';
import ServicesHero from '@/components/sections/services/ServicesHero';
import ServicePillar from '@/components/sections/services/ServicePillar';
import AILayer from '@/components/sections/services/AILayer';
import ServicesCTA from '@/components/sections/services/ServicesCTA';
// Icon names passed as strings — resolved in client component

const BASE_URL = 'https://letsbe.biz';

// ─── Metadata ─────────────────────────────────────────────────────────────────

type PageProps = {
  params: Promise<{ locale: string }>;
};

export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
  const { locale } = await params;
  const t = await getTranslations({ locale, namespace: 'meta.services' });

  const path = locale === 'en' ? '/services' : `/${locale}/services`;

  return {
    title: t('title'),
    description: t('description'),
    alternates: {
      canonical: `${BASE_URL}${path}`,
      languages: {
        'en': `${BASE_URL}/services`,
        'fr': `${BASE_URL}/fr/services`,
        'it': `${BASE_URL}/it/services`,
        'es': `${BASE_URL}/es/services`,
        'x-default': `${BASE_URL}/services`,
      },
    },
  };
}

// ─── Service data ──────────────────────────────────────────────────────────────

export const SERVICE_PILLARS = [
  {
    id: 'design-development',
    numeral: '01',
    title: 'Web Design & Development',
    description:
      'Your website shouldn\'t look like everyone else\'s — and it shouldn\'t be built like everyone else\'s either. We design and build custom websites and web applications from a blank canvas, crafting every layout, every interaction, and every page with intention. The result is fast, search-engine-friendly, and built to grow with your business. Whether you need a marketing site that converts, a web application your team relies on, or an e-commerce platform that scales — we build it from scratch, and we build it to last.',
    background: 'bg-surface' as const,
    features: [
      {
        icon: 'Palette',
        title: 'Custom Design',
        description:
          'Every layout, component, and interaction is designed for your brand. No themes, no templates, no shortcuts.',
      },
      {
        icon: 'Globe',
        title: 'Web Applications',
        description:
          'Modern, responsive applications built with the latest technologies — fast, reliable, and ready to scale.',
      },
      {
        icon: 'ShoppingCart',
        title: 'E-Commerce',
        description:
          'Custom storefronts, checkout flows, and multi-currency platforms built for serious online retail.',
      },
      {
        icon: 'Zap',
        title: 'Performance & SEO',
        description:
          'Fast load times, clean code, and search engine optimization built into the foundation — not bolted on after.',
      },
    ],
  },
  {
    id: 'custom-systems',
    numeral: '02',
    title: 'Software & Platforms',
    description:
      'Off-the-shelf software makes assumptions about how your business works. We don\'t. When spreadsheets and generic tools stop cutting it, we build the exact system your team needs — designed around your workflow, not someone else\'s. From CRMs tailored to your sales process, to management platforms that replace three different subscriptions, to integrations that connect your existing tools — everything we build is yours, fully documented, and built to last.',
    background: 'bg-surface-low' as const,
    features: [
      {
        icon: 'Database',
        title: 'CRM & Management Tools',
        description:
          'Relationship and pipeline management built around how your team actually works — not how a generic platform thinks you should.',
      },
      {
        icon: 'Code2',
        title: 'Custom Software',
        description:
          'From booking platforms to internal tools to full SaaS products — purpose-built for your business.',
      },
      {
        icon: 'GitBranch',
        title: 'Integrations & APIs',
        description:
          'We connect your existing tools and build the bridges between systems so everything works together.',
      },
      {
        icon: 'Wrench',
        title: 'Dashboards & Automation',
        description:
          'Admin panels, reporting tools, and workflow automation that give your team an unfair advantage.',
      },
    ],
  },
  {
    id: 'infrastructure',
    numeral: '03',
    title: 'Hosting & Infrastructure',
    description:
      'Your website and software need a home — and we think you should own it. We set up and manage dedicated servers, email, cloud storage, and all the infrastructure your business runs on. No shared hosting, no mysterious third-party dependencies. You know where your data lives, who has access, and that someone is watching the dashboard around the clock.',
    background: 'bg-surface' as const,
    features: [
      {
        icon: 'Server',
        title: 'Dedicated Hosting',
        description:
          'Private servers managed for your business — no shared hosting, no noisy neighbors, no surprises.',
      },
      {
        icon: 'Shield',
        title: 'Your Data, Your Control',
        description:
          'You own your data and know exactly where it lives. Full access, full transparency, no lock-in.',
      },
      {
        icon: 'Lock',
        title: 'Security & Protection',
        description:
          'Serious security, proactive monitoring, and protection built into your infrastructure from day one.',
      },
      {
        icon: 'Settings',
        title: 'Monitoring & Support',
        description:
          'Proactive monitoring, regular updates, and ongoing support so you never have to worry about uptime.',
      },
    ],
  },
] as const;

// ─── AI Layer data ─────────────────────────────────────────────────────────────

export const AI_CAPABILITIES = [
  {
    id: 'ai-teammate',
    title: 'AI Teammate',
    description:
      'An AI assistant built into your workflow — automates repetitive tasks, surfaces the info your team needs, and connects your tools.',
  },
  {
    id: 'customer-facing-ai',
    title: 'Customer-Facing AI',
    description:
      'Smart features for your customers — intelligent search, personalized recommendations, and conversational interfaces that work around the clock.',
  },
  {
    id: 'data-intelligence',
    title: 'Data Intelligence',
    description:
      'AI that helps you understand your data — automated reports, trend spotting, and insights you can actually act on.',
  },
] as const;

// ─── Page ──────────────────────────────────────────────────────────────────────

type Props = {
  params: Promise<{ locale: string }>;
};

export default async function ServicesPage({ params }: Props) {
  const { locale } = await params;
  setRequestLocale(locale);

  return (
    <main>
      <ServicesHero />

      {SERVICE_PILLARS.map((pillar, index) => (
        <ServicePillar
          key={pillar.id}
          pillar={pillar}
          index={index}
        />
      ))}

      <AILayer capabilities={AI_CAPABILITIES} />

      <ServicesCTA />
    </main>
  );
}
