"use client";

import CallC from "../../icons/CallC";
import EmailC from "../../icons/EmailC";
import WhatsappC from "../../icons/WhatsappC";
import ContentContact from "../ContentContact";

function Links({ matchedCity }) {
  const phone = matchedCity?.contact_phone || "+98 2191550875";
  const whatsapp = matchedCity?.social_media?.whatsapp || "09390039833";
  const email = matchedCity?.email || "info@clinic-pro.ir";
  // wa.me needs international format: 09xx… → 989xx…
  const waDigits = whatsapp.replace(/\D/g, "").replace(/^0/, "98");

  return (
    <ul className="flex flex-col mt-[68px] justify-start items-start gap-[32px]">
      <ContentContact
        url={`tel:${phone.replace(/\s/g, "")}`}
        label="تلفن تماس: "
        text={phone}
      >
        <CallC />
      </ContentContact>
      <ContentContact
        url={`https://wa.me/${waDigits}`}
        text={whatsapp}
        label="واتساپ: "
      >
        <WhatsappC />
      </ContentContact>
      <ContentContact
        url={`mailto:${email}`}
        text={email}
        label="ایمیل: "
      >
        <EmailC />
      </ContentContact>
    </ul>
  );
}

export default Links;
