"use client"

import { useState } from "react"
import { Button } from "@/components/ui/button"
import { GetFreeMachineModal } from "@/components/get-free-machine-modal"
import { cn } from "@/lib/utils"

type GetFreeMachineCtaProps = {
  buttonLabel?: string
  className?: string
  size?: "default" | "sm" | "lg"
  variant?: "default" | "outline" | "secondary" | "ghost" | "link" | "brand"
}

export function GetFreeMachineCta({
  buttonLabel = "Get Free Machine",
  className,
  size = "lg",
  variant = "default",
}: GetFreeMachineCtaProps) {
  const [isOpen, setIsOpen] = useState(false)

  return (
    <>
      <Button
        type="button"
        size={size}
        variant={variant}
        className={cn("rounded-full px-6", className)}
        onClick={() => setIsOpen(true)}
      >
        {buttonLabel}
      </Button>
      <GetFreeMachineModal open={isOpen} onOpenChange={setIsOpen} />
    </>
  )
}
