import { FC, useState } from 'react';
import { MessageText1 } from 'iconsax-react';
import Chatbot from './Chatbot';

const ChatbotButton: FC = () => {
    const [isChatbotOpen, setIsChatbotOpen] = useState<boolean>(false);

    const toggleChatbot = () => {
        setIsChatbotOpen(!isChatbotOpen);
    };

    return (
        <>
            <button
                onClick={toggleChatbot}
                className="fixed bottom-5 right-5 bg-primary text-white rounded-full w-14 h-14 flex items-center justify-center shadow-lg hover:bg-gray-800 transition-colors z-40"
                aria-label="چت با پشتیبانی"
            >
                <MessageText1 size={24} />
            </button>

            <Chatbot isOpen={isChatbotOpen} onClose={() => setIsChatbotOpen(false)} />
        </>
    );
};

export default ChatbotButton; 