import { useMainContext } from "../MainProvider";
import { Radio, Space, Typography } from "antd";
import { PostType } from "@nice/common"; // Assuming PostType is defined in this path

export default function SearchModeRadio() {
	const { searchMode, setSearchMode } = useMainContext();

	const handleModeChange = (e) => {
		setSearchMode(e.target.value);
	};

	return (
		<Space direction="vertical" align="start" className="mb-2">
			<h3 className="text-lg font-medium mb-4">搜索模式</h3>
			<Radio.Group
				value={searchMode}
				onChange={handleModeChange}
				buttonStyle="solid">
				<Radio.Button value={PostType.COURSE}>课程</Radio.Button>
				<Radio.Button value={PostType.PATH}>路径</Radio.Button>
				<Radio.Button value="both">全部</Radio.Button>
			</Radio.Group>
		</Space>
	);
}
