"use client";

import React from "react";
import { useMessageModal } from "@/app/components/ui/MessageModalProvider";

type Props = {
  receiverId: string;
  receiverNickname?: string | null;
  className?: string;
  size?: "sm" | "md";
};

export function SendMessageButton({ receiverId, receiverNickname, className, size = "sm" }: Props) {
  const { openMessageModal } = useMessageModal();
  const padding = size === "md" ? "px-3 py-1.5" : "px-2 py-1";
  const text = size === "md" ? "text-sm" : "text-xs";

  return (
    <button
      type="button"
      onClick={() => openMessageModal({ receiverId, receiverNickname: receiverNickname ?? null })}
      className={`inline-flex items-center rounded-md border border-neutral-300 bg-white ${padding} ${text} text-neutral-800 hover:bg-neutral-100 cursor-pointer ${className || ""}`}
      aria-label="쪽지 보내기"
    >
      쪽지 보내기
    </button>
  );
}


