import { MapPin, Code, Briefcase, Download } from "lucide-react";
import { headers } from "next/headers";
import { Icon } from "@iconify/react";
import Link from "next/link";

export default async function Portfolio() {
  const headersList = await headers();
  const ip = headersList.get("x-forwarded-for");

  // Replace with your chosen IP geolocation API
  const response = await fetch(`https://ipapi.co/${ip}/json/`);
  const { country } = await response.json();
  let isIndianVisitor = false;
  if (country == "IN") {
    isIndianVisitor = true;
  }
  console.log(ip, isIndianVisitor);

  // const skillsLeft = {
  //   "Programming Languages": {
  //     Python: "vscode-icons:file-type-python",
  //     JavaScript: "vscode-icons:file-type-js-official",
  //     TypeScript: "vscode-icons:file-type-typescript-official",
  //     Golang: "material-icon-theme:go",
  //   },
  //   AI: {
  //     LangChain: "simple-icons:langchain",
  //     Livekit: "",
  //     ElevenLabs: "simple-icons:elevenlabs",
  //     Ollama: "simple-icons:ollama",
  //     vllm: "",
  //   },
  //   Databases: {
  //     Postgres: "devicon:postgresql",
  //     Redis: "devicon:redis",
  //     ClickHouse: "devicon:clickhouse",
  //     etcd: "logos:etcd",
  //     Meilisearch: "logos:meilisearch",
  //     Typesense: "logos:typesense-icon",
  //     qdrant: "logos:qdrant-icon",
  //     MySQL: "logos:mysql-icon",
  //   },
  //   "Cloud Providers": {
  //     AWS: "logos:aws",
  //     "Microsoft Azure": "material-icon-theme:azure",
  //     "Google Cloud Platform GCP": "material-icon-theme:gcp",
  //     DigitalOcean: "devicon:digitalocean",
  //     // Scaleway: "simple-icons:scaleway",
  //     // Hetzner: "simple-icons:hetzner",
  //     Cloudflare: "devicon:cloudflare",
  //   },
  // };
  // const skillsRight = {
  //   "Web Frameworks": {
  //     FastAPI: "devicon:fastapi",
  //     Django: "material-icon-theme:django",
  //     "Next.js": "devicon:nextjs",
  //     Flask: "simple-icons:flask",
  //     ReactJS: "material-icon-theme:react",
  //   },
  //
  //   DevOps: {
  //     Kubernetes: "material-icon-theme:kubernetes",
  //     Ansible: "devicon:ansible",
  //     Docker: "material-icon-theme:docker",
  //     // Vagrant: "material-icon-theme:vagrant",
  //     // "VMware ESXi": "carbon:logo-vmware",
  //     Nomad: "devicon:nomad",
  //     Terraform: "material-icon-theme:terraform",
  //     Bash: "devicon:bash",
  //     // Packer: "devicon:packer",
  //     // "HashiCorp Vault": "devicon:vault",
  //     Jenkins: "material-icon-theme:jenkins",
  //     // KVM: "simple-icons:qemu",
  //     // Nagios: null,
  //     Prometheus: "devicon:prometheus",
  //     Grafana: "devicon:grafana",
  //     // InfluxDB: "devicon:influxdb",
  //     Sentry: "material-icon-theme:sentry",
  //     Kafka: "devicon:apachekafka",
  //     // Selenium: "devicon:selenium",
  //   },
  //   Robotics: {
  //     "Robot Operating System ROS": "devicon:ros",
  //   },
  //   "Spoken Languages": {
  //     English: "",
  //     Hindi: "",
  //     Marathi: "",
  //     Konkani: "",
  //   },
  // };

  const workExperience = [
    {
      company: "Grapevine",
      link: "https://grapevine.in",
      title: "1st Engineer / Engineering Lead / CTO",
      tenure: "May 2022 - Present",
      location: "Bengaluru",
      summary:
        "Led engineering teams from inception to $3M seed funding, architecting scalable Django/PostgreSQL/Kubernetes backend infrastructure supporting 600k+ users with 99.9% uptime. Built real-time Kafka/ClickHouse pipelines (1M+ events/day) boosting feature adoption 25%, and hybrid Qdrant/Meilisearch systems increasing engagement 80%. Created AI-driven interview platforms using LiveKit/ElevenLabs for personalized candidate experiences at scale.",
    },
    {
      company: "e-Yantra, IIT Bombay",
      link: "https://portal.e-yantra.org/",
      title: "Project Engineer",
      tenure: "Apr 2021 - Dec 2023",
      location: "Mumbai",
      summary:
        "Developed a modular drone platform using Raspberry Pi, NVIDIA Jetson AGX, ZED camera, GoPro, GPS, and optical flow sensors with ROS, enabling real-time video streaming, flight data aggregation, cloud photogrammetry, and autonomous navigation. Designed containerized simulation environments for secure robotics/AI testing and engineered GPU slicing frameworks for optimized ML resource distribution across virtual machines.",
      keyPoints: [
        "Developed a modular drone platform integrating Raspberry Pi, NVIDIA Jetson AGX, ZED stereo camera, GoPro, GPS, and optical ﬂow sensors using ROS, enabling real-time video streaming, ﬂight data aggregation, cloud-based photogrammetry, and autonomous navigation capabilities",
        "Designed and implemented a containerized simulation platform, enabling secure, isolated, and reproducible evaluation of robotics and AI workloads",
        "Engineered a GPU slicing and distribution framework for NVIDIA GPUs, optimizing resource utilization across multiple virtual machines for scalable machine learning training and browser-based remote Linux workstations",
      ],
    },
    {
      company: "BrowserStack",
      link: "https://browserstack.com",
      title: "Cloud Infrastructure and Security Engineer",
      tenure: "May 2019 - Mar 2021",
      location: "Mumbai",
      summary:
        "Reduced AWS costs by 15% ($150k/year) via reserved instances, snapshots, and S3 lifecycle policies while ensuring 99.9% uptime SLA. Enhanced security with CIS Controls, 99.5% DMARC compliance, VPN deployment, and Cloudflare optimization for 3x faster page loads. Migrated critical systems with <0.1% downtime and established robust disaster recovery.",
      keyPoints: [
        "Reduced AWS costs by 15% on $1M annual bill through reserved EC2 instances optimization, snapshot management, and S3 lifecycle policies while maintaining 99.9% uptime SLA",
        "Enhanced security posture by implementing CIS Controls, improving DMARC rating to 99.54%, setting up VPN for data centers, and deploying Cloudﬂare to reduce page load times by 3x",
        "Orchestrated critical infrastructure migrations with <0.1% downtime, and executed disaster recovery planning for AWS",
      ],
    },
    {
      company: "Frappe Technologies Pvt. Ltd. / ERPNext",
      link: "https://frappe.io/erpnext",
      title: "Software Engineer (Research and Development)",
      tenure: "Jun 2017 - Nov 2018",
      location: "Mumbai",
      summary:
        "Implemented email tracking pixels in outbound campaigns to monitor engagement and enable targeted follow-ups, boosting response rates by 18%. Developed the Bench Manager GUI for real-time monitoring of Frappe-hosted sites, presented at the ERPNext Conference, which streamlined system administration tasks through Socket.IO-powered live updates.",
      keyPoints: [
        "Implemented email tracking pixels in outbound campaigns, enabling email engagement tracking and allowing targeted follow-ups that boosted response rates by 18%",
        "Developed Bench Manager GUI for real-time monitoring of Frappe-hosted sites, presented at ERPNext Conference, streamlining system administration tasks and live updates through Socket.IO",
      ],
    },
  ];

  return (
    <main className="flex items-top justify-center font-[family-name:var(--font-spacegrotesk-sans)] pt-10 md:pt-20 pb-25 md:pb-0">
      <div className="">
        <div className="uppercase tracking-[0.2em] text-gray-500 dark:text-gray-100 flex items-center justify-between pb-20">
          <div>About Me</div>
          <Link
            href="https://resume.codingcoffee.me"
          >
            <div className="flex border-gray-200 border-2 p-2 pointer-cursor underline">
              Resume
              <Download />
            </div>
          </Link>
        </div>
        <div className="grid grid-cols-1 md:grid-cols-2 md:w-[40vw] w-[95vw] md:min-w-3xl">
          <div>
            <div className="pb-10">
              <div className="text-5xl md:text-6xl pb-5">Hi, I'm</div>
              <div className="text-5xl md:text-6xl text-red-500">
                Ameya Shenoy
              </div>
            </div>
            <div className="text-gray-500 dark:text-gray-100 text-lg pb-10">
              <div className="flex items-center pb-2">
                <MapPin className="stroke-1 text-red-500" />
                <span className="pl-2">Based in India</span>
              </div>
              <div className="flex items-center pb-2">
                <Code className="stroke-1 text-red-500" />
                <span className="pl-2">
                  Principal Engineer / Engineering Lead
                </span>
              </div>
              <div className="flex items-center pb-2">
                <Briefcase className="stroke-1 text-red-500" />
                <span className="pl-2">8+ years experience</span>
              </div>
            </div>
          </div>
          <div className="md:text-2xl/10 text-xl/8 pb-20">
            Engineering lead with 8+ years of expertise in designing scalable
            system architecture, leading high performing teams, and delivering
            ai driven solutions while also maintaining the role of an individual
            contributor.
          </div>
        </div>
        <div className="md:w-[40vw] w-[95vw] md:min-w-3xl">
          <div className="text-3xl pb-10">Work Experience</div>
          {workExperience.map((job, index) => (
            <div key={index} className="">
              <div className="flex items-center justify-between pb-5">
                <Link
                  href={job.link}
                  target="_blank"
                  rel="noopener noreferrer"
                  className="text-xl underline"
                >
                  {job.company}
                </Link>
                <p className="text-xl">{job.tenure}</p>
              </div>
              <p className="text-2xl text-red-500 pb-5">{job.title}</p>
              <p className="text-gray-500 dark:text-gray-100 text-justify text-xl/8 pb-8">
                {job.summary}
              </p>
            </div>
          ))}
        </div>
      </div>
    </main>
  );
}
