"use client";

import { Button, Spinner } from "@heroui/react";

type WishlistActionsProps = {
  onRemove: () => void;
  onAddToCart: () => void;
  isRemoving: boolean;
  isAddingToCart: boolean;
  isAvailable: boolean;
};

export function WishlistActions({
  onRemove,
  onAddToCart,
  isRemoving,
  isAddingToCart,
  isAvailable,
}: WishlistActionsProps) {
  return (
    <div className="flex flex-col gap-2 md:flex-row">
      <Button
        className="w-full bg-[#f4a13a] font-medium text-white hover:bg-[#e0922e] md:w-auto md:flex-1"
        isDisabled={!isAvailable || isAddingToCart}
        onPress={onAddToCart}
      >
        {isAddingToCart ? (
          <>
            <Spinner size="sm" color="current" />
            Adding…
          </>
        ) : (
          "Add to Cart"
        )}
      </Button>
      <Button
        variant="ghost"
        className="w-full text-[var(--coral)] hover:bg-[#fce0da] md:w-auto"
        isDisabled={isRemoving}
        onPress={onRemove}
      >
        {isRemoving ? (
          <>
            <Spinner size="sm" color="current" />
            Removing…
          </>
        ) : (
          "Remove"
        )}
      </Button>
    </div>
  );
}
