import Stack from "@/twui/components/layout/Stack";
import { Dispatch, SetStateAction } from "react";
import {
    NormalizedServerObject,
    ParsedDeploymentServiceConfig,
} from "@/src/types";
import Row from "@/twui/components/layout/Row";
import ServiceClusterServerLogSelectorSetCustomLog from "./cluster-server-log-selector-set-custom-log";
import ServiceClusterServerLogSelectorSelectLog from "./cluster-server-log-selector-select-log";

type Props = {
    service: ParsedDeploymentServiceConfig;
    server: NormalizedServerObject;
    setLog: Dispatch<SetStateAction<string | undefined>>;
    log?: string;
};

export default function ServiceClusterServerLogSelector({
    service,
    setLog,
    log,
}: Props) {
    return (
        <Stack className="w-full gap-2 p-4">
            <Row className="flex-nowrap">
                <ServiceClusterServerLogSelectorSetCustomLog setLog={setLog} />
                <ServiceClusterServerLogSelectorSelectLog
                    service={service}
                    setLog={setLog}
                    log={log}
                />
            </Row>
        </Stack>
    );
}
