import { PublicLayout } from '@/components/layout/public-layout'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import Link from 'next/link'
import { Button } from '@/components/ui/button'
import { Star, Download, ExternalLink } from 'lucide-react'

export default function PartnerMarketplacePage() {
  const solutions = [
    {
      id: '1',
      name: 'Enterprise Security Suite',
      partner: 'SecureCorp',
      description: 'Comprehensive security solution for enterprise deployments',
      rating: 4.8,
      downloads: 1250,
      category: 'Security',
      logo: '🔒',
    },
    {
      id: '2',
      name: 'Data Analytics Platform',
      partner: 'DataFlow Inc',
      description: 'Advanced analytics and reporting for cloud infrastructure',
      rating: 4.6,
      downloads: 890,
      category: 'Analytics',
      logo: '📊',
    },
    {
      id: '3',
      name: 'DevOps Automation Tools',
      partner: 'AutoDev Solutions',
      description: 'Automated CI/CD pipelines and deployment workflows',
      rating: 4.9,
      downloads: 2100,
      category: 'DevOps',
      logo: '⚙️',
    },
  ]

  return (
    <PublicLayout>
      <div className="min-h-screen bg-studio-black py-24 px-4">
        <div className="mx-auto max-w-7xl">
          <div className="mb-12">
            <h1 className="mb-4 text-5xl font-bold text-white">Partner Marketplace</h1>
            <p className="text-xl text-gray-400">
              Discover solutions from our certified partners
            </p>
          </div>

          <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
            {solutions.map((solution) => (
              <Card key={solution.id} className="hover:border-phoenix-fire transition-colors">
                <CardHeader>
                  <div className="flex items-start justify-between mb-2">
                    <div className="text-4xl">{solution.logo}</div>
                    <span className="px-2 py-1 text-xs bg-studio-dark text-gray-400 rounded">
                      {solution.category}
                    </span>
                  </div>
                  <CardTitle className="text-white">{solution.name}</CardTitle>
                  <CardDescription className="text-gray-400">
                    by {solution.partner}
                  </CardDescription>
                </CardHeader>
                <CardContent>
                  <p className="text-sm text-gray-300 mb-4">{solution.description}</p>
                  
                  <div className="flex items-center gap-4 mb-4 text-sm text-gray-400">
                    <div className="flex items-center gap-1">
                      <Star className="h-4 w-4 text-yellow-400 fill-yellow-400" />
                      <span>{solution.rating}</span>
                    </div>
                    <div className="flex items-center gap-1">
                      <Download className="h-4 w-4" />
                      <span>{solution.downloads.toLocaleString()}</span>
                    </div>
                  </div>

                  <div className="flex gap-2">
                    <Button variant="outline" className="flex-1" asChild>
                      <Link href={`/marketplace/partners/${solution.id}`}>
                        View Details
                      </Link>
                    </Button>
                    <Button variant="phoenix" asChild>
                      <Link href={`/marketplace/partners/${solution.id}/install`}>
                        Install
                      </Link>
                    </Button>
                  </div>
                </CardContent>
              </Card>
            ))}
          </div>

          <div className="mt-12 text-center">
            <h2 className="mb-4 text-2xl font-bold text-white">Become a Partner</h2>
            <p className="mb-6 text-gray-400">
              List your solution in our marketplace and reach thousands of customers
            </p>
            <Button variant="phoenix" size="lg" asChild>
              <Link href="/partners/register">Register as Partner</Link>
            </Button>
          </div>
        </div>
      </div>
    </PublicLayout>
  )
}

