import { StatisticsTab } from "../components/StatisticsTabSegmentedControl/StatisticsTabSegmentedControl.tsx";
import styles from "./StatisticsPage.module.css";
import { ProfitTab } from "../tabs/ProfitTab/ProfitTab.tsx";
import { useSelector } from "react-redux";
import { RootState } from "../../../redux/store.ts";
import { Navigate } from "@tanstack/react-router";

export const StatisticsPage = () => {
    const userRole = useSelector((state: RootState) => state.auth.role);

    if (userRole !== "admin") {
        return <Navigate to={"/leads"} />;
    }

    const serviceType = StatisticsTab.PROFIT;

    const getBody = () => {
        switch (serviceType) {
            case StatisticsTab.PROFIT:
                return (
                    <ProfitTab />
                );
        }
    };

    return (
        <div className={styles["container"]}>
            {/*<PageBlock>*/}
            {/*    <StatisticsTabSegmentedControl*/}
            {/*        size={"md"}*/}
            {/*        value={serviceType.toString()}*/}
            {/*        onChange={event => setServiceType(parseInt(event))}*/}
            {/*    />*/}
            {/*</PageBlock>*/}
            {getBody()}
        </div>
    );
};