import { useGlobalStore } from '@/store/global';
import './index.css';
import { isEmpty } from 'lodash-es';
import { EVENT, useMujian } from '@/providers/MujianProvider';

function Home() {
	const { count, increment } = useGlobalStore((state) => state);
	const mujian = useMujian();

	console.log('count', count);

	console.log('isEmpty', isEmpty(count));

	return (
		<>
			<div>
				<div className="text-3xl font-bold underline">Hello World2</div>
			</div>
			<h1>Vite + React</h1>
			<button type="button" onClick={increment}>
				Increment
			</button>

			<p>Count: {count}</p>

			<br />

			<button
				type="button"
				onClick={async () => {
					mujian.emit(EVENT.MUJIAN_AI_CHAT_SEND_MESSAGE, {
						message: 'Hello, World!',
					});
				}}
			>
				Hello
			</button>
		</>
	);
}

export default Home;
