"use client";

import { Button } from "@/components/ui/button";
import { getContactLink } from "@/lib/constants";
import { cn } from "@/lib/utils";

interface CallButtonProps {
    variant?: "blue" | "amber";
    fullWidth?: boolean;
    text?: string;
    showIcon?: boolean;
    rounded?: boolean;
    page?: string;
}

export default function CallButton({
    variant = "blue",
    fullWidth,
    text,
    rounded,
    page,
}: CallButtonProps) {
    const handleClick = () => {
        // @ts-ignore
        if (typeof gtag_report_conversion === "function") {
            gtag_report_conversion();
        }
    };

    return (
        <a href={getContactLink(page)} onClick={handleClick}>
            <Button
                size="lg"
                variant={variant}
                className={cn(fullWidth ? "w-full" : "")}
                rounded={rounded ? "full" : "default"}
            >
                <p>{text ? text : "Call Now"}</p>
            </Button>
        </a>
    );
}
