import { useSettingStore } from "../../../-lib/store/useSettings";
import ForecastImport from "./ForecastImport";
import OrderImport from "./OrderImport";

export default function DMButtons() {
    const { settings } = useSettingStore();
    const testServers = ["test1", "test2", "test3"];
    const plantToken = settings.filter((n) => n.name === "plantToken");

    //console.log(plantToken);
    return (
        <div className="flex flex-row-reverse gap-1">
            <OrderImport fileType={"macro"} name={"Macro Import"} />
            {/* dev and testserver sees all */}
            {testServers.includes(plantToken[0]?.value) && (
                <div className="flex flex-row gap-2">
                    <OrderImport
                        fileType={"abbott"}
                        name={"Abbott truck list"}
                    />
                    <OrderImport
                        fileType={"energizer"}
                        name={"Energizer Truck List"}
                    />
                    <ForecastImport fileType={"loreal"} name={"VMI Import"} />
                    <ForecastImport fileType={"pg"} name={"P&G"} />
                    <ForecastImport
                        fileType={"energizer"}
                        name={"Energizer Forecast"}
                    />
                </div>
            )}
            {plantToken[0]?.value === "usday1" && (
                <div className="flex flex-row gap-2">
                    <OrderImport
                        fileType={"abbott"}
                        name={"Abbott truck list"}
                    />
                    <OrderImport
                        fileType={"energizer"}
                        name={"Energizer Truck List"}
                    />
                    <ForecastImport
                        fileType={"energizer"}
                        name={"Energizer Forecast"}
                    />
                </div>
            )}
            {plantToken[0]?.value === "usflo1" && (
                <div className="flex flex-row gap-2">
                    <ForecastImport fileType={"loreal"} name={"VMI Import"} />
                </div>
            )}
            {plantToken[0]?.value === "usstp1" && (
                <div className="flex flex-row gap-2"></div>
            )}
            {plantToken[0]?.value === "usiow1" && (
                <div className="flex flex-row gap-2">
                    <ForecastImport fileType={"pg"} name={"P&G"} />
                </div>
            )}
            {plantToken[0]?.value === "usiow2" && (
                <div className="flex flex-row gap-2">
                    <ForecastImport fileType={"pg"} name={"P&G"} />
                </div>
            )}
            {plantToken[0]?.value === "usksc1" && (
                <div className="flex flex-row gap-2">
                    <ForecastImport fileType={"pg"} name={"P&G"} />
                </div>
            )}
        </div>
    );
}
