import GeneralLoading from "../General/GeneralLoading";
import SearchPage from "./SearchPage";
import { searchStockTransactions } from "@/app/api/stockTake/actions";

interface SubComponents {
    Loading: typeof GeneralLoading;
}

const Wrapper: React.FC & SubComponents = async () => {
    // 初始加载时使用空参数，SearchPage 会在用户搜索时调用 API
    const dataList = await searchStockTransactions({
        startDate: null,
        endDate: null,
        itemCode: null,
        itemName: null,
        type: null,
        pageNum: 0,
        pageSize: 100,
    });

    return <SearchPage dataList={dataList?.records ?? []} />;
};

Wrapper.Loading = GeneralLoading;

export default Wrapper;