export type AppConfig = {
  baseRoot?: string;
  baseApi?: string;
  baseAuth?: string;
  baseDashboard?: string;
  initialGuildId?: string;
};

export type User = {
  username: string;
  discriminator?: string;
  isAdmin?: boolean;
};

export type Guild = {
  id: string;
  name: string;
  icon?: string;
};

export type NavKey =
  | 'overview'
  | 'tickets'
  | 'supportlogin'
  | 'automod'
  | 'welcome'
  | 'dynamicvoice'
  | 'birthday'
  | 'reactionroles'
  | 'statuspage'
  | 'serverstats'
  | 'register'
  | 'music'
  | 'settings'
  | 'modules'
  | 'events'
  | 'admin';

export type TicketRecord = {
  id: string;
  topic?: string;
  status?: string;
  category?: string;
  priority?: string;
  createdAt?: string;
  claimedById?: string | null;
};

export type StatusService = {
  id: string;
  name?: string;
  url?: string;
  status?: string;
  uptimePct?: number;
  lastCheckedAt?: string;
};

export type EventItem = {
  id: string;
  title: string;
  description?: string;
  startsAt?: string;
  reminderMinutes?: number;
  channelId?: string;
};

export type ReactionRoleSet = {
  id: string;
  title?: string;
  description?: string;
  channelId?: string;
  messageId?: string;
  entries?: Array<{ emoji: string; roleId: string; label?: string; description?: string }>;
};

export type ModuleItem = {
  key: string;
  name: string;
  description?: string;
  enabled: boolean;
};

export type LogEntry = {
  level?: string;
  category?: string;
  message?: string;
  timestamp?: string;
};

export type SettingsState = Record<string, any>;

export type NavItem = {
  key: NavKey;
  label: string;
  icon: React.ReactNode;
};

export type SupportLoginConfig = {
  panelChannelId?: string;
  panelMessageId?: string;
  title?: string;
  description?: string;
  loginLabel?: string;
  logoutLabel?: string;
  autoRefresh?: boolean;
};

export type SupportLoginStatus = {
  active: { userId: string; username?: string; loggedInAt?: string }[];
};

export type RegisterFormField = {
  id?: string;
  label: string;
  type: 'text' | 'paragraph' | 'select' | 'multi';
  required?: boolean;
  placeholder?: string;
  options?: string[];
};

export type RegisterForm = {
  id: string;
  guildId: string;
  name: string;
  description?: string;
  reviewChannelId?: string;
  notifyRoleIds?: string[];
  isActive: boolean;
  fields: RegisterFormField[];
  createdAt?: string;
};

export type RegisterApplication = {
  id: string;
  formId: string;
  userId: string;
  username?: string;
  status: 'pending' | 'approved' | 'rejected';
  answers: { fieldId?: string; label?: string; value: string }[];
  createdAt?: string;
};

export type MusicSession = {
  guildId: string;
  nowPlaying?: { title: string; url: string } | null;
  queueLength: number;
  loop: 'off' | 'song' | 'queue';
};
