import { router, Stack } from "expo-router";
import { Alert } from "react-native";

import { AppBackground } from "@/components/AppBackground";
import { BusinessForm } from "@/components/businesses/BusinessForm";
import { useTabBarScrollPadding } from "@/lib/tab-bar-insets";

export default function NewBusinessScreen() {
  const scrollPadding = useTabBarScrollPadding();

  return (
    <AppBackground>
      <Stack.Screen options={{ headerBackTitle: "Entities" }} />
      <BusinessForm
        mode="create"
        scrollPadding={scrollPadding}
        onSaved={() => {
          Alert.alert("Business created", "Your business has been saved.", [
            { text: "OK", onPress: () => router.back() },
          ]);
        }}
      />
    </AppBackground>
  );
}
