import type { NativeStackScreenProps } from '@react-navigation/native-stack';

// Root stack — tabs always visible, auth screens are modals on top
export type RootStackParamList = {
  Main: undefined;
  Login: undefined;
  Signup: undefined;
  ForgotPassword: undefined;
};

// App tabs
export type AppTabParamList = {
  MarketplaceTab: undefined;
  DashboardTab: undefined;
  InboxTab: undefined;
  AccountTab: undefined;
};

// Marketplace stack (fully public)
export type MarketplaceStackParamList = {
  MarketplaceList: undefined;
  MarketplaceDetail: { chatbotId: string };
  PublicChat: { chatbotId: string; chatbotName: string };
};

// Dashboard stack (requires auth)
export type DashboardStackParamList = {
  ChatbotList: undefined;
  ChatbotBuilder: { chatbotId?: string };
  ChatPreview: { chatbotId: string; chatbotName: string };
};

// Inbox stack (requires auth)
export type InboxStackParamList = {
  InboxList: undefined;
  Conversation: { conversationId: string; chatbotName?: string };
};

// Account stack (guest screen or settings)
export type AccountStackParamList = {
  AccountHome: undefined;
  Leads: undefined;
  Analytics: undefined;
  Campaigns: undefined;
  Appointments: undefined;
};

// Screen prop helpers
export type RootScreenProps<T extends keyof RootStackParamList> =
  NativeStackScreenProps<RootStackParamList, T>;

export type MarketplaceScreenProps<T extends keyof MarketplaceStackParamList> =
  NativeStackScreenProps<MarketplaceStackParamList, T>;

export type DashboardScreenProps<T extends keyof DashboardStackParamList> =
  NativeStackScreenProps<DashboardStackParamList, T>;

export type InboxScreenProps<T extends keyof InboxStackParamList> =
  NativeStackScreenProps<InboxStackParamList, T>;

export type AccountScreenProps<T extends keyof AccountStackParamList> =
  NativeStackScreenProps<AccountStackParamList, T>;

// Auth screen props (kept for backward compat)
export type AuthStackParamList = {
  Login: undefined;
  Signup: undefined;
  ForgotPassword: undefined;
};
export type AuthScreenProps<T extends keyof AuthStackParamList> =
  NativeStackScreenProps<AuthStackParamList, T>;

// Legacy aliases
export type SettingsStackParamList = AccountStackParamList;
export type SettingsScreenProps<T extends keyof AccountStackParamList> =
  AccountScreenProps<T>;
