// Re-export everything from domain modules so that existing imports
// from "@/lib/api" continue to work without modification.

export { API_BASE, request } from "./core";

export type {
  LoginResponse,
  User,
  MeResponse,
  CreateUserRequest,
  UpdateUserRequest,
} from "./users";
export {
  login,
  getMe,
  logout,
  changePassword,
  changeEmail,
  updatePreferences,
  getUsers,
  createUser,
  updateUser,
  deleteUser,
  getTOTPSetup,
  confirmTOTPSetup,
  disableTOTP,
} from "./users";

export type {
  LDAPGroupMapping,
  LDAPConfig,
  LDAPTestUser,
  LDAPTestResult,
  LDAPFilterSuggestion,
} from "./ldap";
export {
  getLDAPConfig,
  saveLDAPConfig,
  deleteLDAPConfig,
  testLDAPConfig,
} from "./ldap";

export type {
  Tenant,
  TenantDomain,
  TenantDefaultUser,
  CreateTenantResponse,
  TenantLDAPConfig,
  LDAPSyncResult,
  TenantUsageEntry,
} from "./tenants";
export {
  getTenants,
  getTenantUsers,
  createTenant,
  updateTenant,
  deleteTenant,
  getTenantDomains,
  addTenantDomain,
  removeTenantDomain,
  getTenantLogoUrl,
  uploadTenantLogo,
  deleteTenantLogo,
  uploadMyTenantLogo,
  deleteMyTenantLogo,
  getTenantLDAPConfig,
  saveTenantLDAPConfig,
  deleteTenantLDAPConfig,
  testTenantLDAPConfig,
  getAdminTenantLDAPConfig,
  saveAdminTenantLDAPConfig,
  deleteAdminTenantLDAPConfig,
  testAdminTenantLDAPConfig,
  syncAdminTenantLDAP,
  getAllTenantUsage,
  setTenantQuota,
} from "./tenants";

export type {
  SearchHit,
  SearchResponse,
  ThreadMail,
  ThreadResponse,
  MailAttachment,
  MailDetail,
  OCRStatus,
  SearchMatchField,
  OCRDownloadResult,
  ImapFolder,
  ImapAccount,
  ImapTestResult,
  Pop3Account,
  Pop3TestResult,
  UploadJob,
} from "./mail";
export {
  searchEmails,
  getMail,
  getThread,
  downloadMailAttachment,
  downloadMailRaw,
  getOCRTextDownloadURL,
  downloadMailOCRText,
  getImapAccounts,
  createImapAccount,
  deleteImapAccount,
  testImapConnection,
  startImapImport,
  getImapProgress,
  triggerImapSync,
  updateImapInterval,
  updateImapAccount,
  getPop3Accounts,
  createPop3Account,
  deletePop3Account,
  testPop3Connection,
  startPop3Import,
  getPop3Progress,
  exportMailPDF,
  exportMailsZIP,
  uploadMailFiles,
  getUploadProgress,
  uploadMailFilesUser,
  getUploadProgressUser,
  exportEDiscovery,
} from "./mail";

export type {
  HealthResponse,
  SystemInfo,
  SMTPStatus,
  StorageStats,
  ServiceStatus,
  AuditEntry,
  AuditResponse,
  SystemStatsCPU,
  SystemStatsRAM,
  SystemStatsDisk,
  SystemStatsMailInfo,
  SystemStatsActivity,
  SystemStatsEstimate,
  SystemStats,
  TimeseriesPoint,
  SecurityCheck,
  SecurityAuditResult,
  CertInfo,
  SelfSignedRequest,
  ACMERequest,
} from "./system";
export {
  getHealth,
  getSystemInfo,
  getSMTPStatus,
  getStorageStats,
  getSystemStats,
  getMailTimeseries,
  getServices,
  serviceAction,
  getAuditLog,
  getSecurityAudit,
  fixSecurityIssue,
  getCertInfo,
  uploadCert,
  generateSelfSignedCert,
  requestACMECert,
} from "./system";

export type {
  RuleConditionType,
  ArchivingRule,
  ArchivingRulesResponse,
  ArchivingRuleInput,
} from "./archiving_rules";
export {
  getArchivingRules,
  createArchivingRule,
  updateArchivingRule,
  deleteArchivingRule,
} from "./archiving_rules";

export type {
  ReconciliationPoint,
  ReconciliationSource,
  ReconciliationResponse,
} from "./reconciliation";
export {
  getReconciliation,
  exportReconciliationCSV,
} from "./reconciliation";

export type {
  RoutingMatchType,
  RoutingRule,
  RoutingRulesResponse,
  RoutingRuleInput,
  RoutingDryRunSample,
  RoutingDryRunResult,
  RoutingDryRunInput,
} from "./routing_rules";
export {
  getRoutingRules,
  createRoutingRule,
  updateRoutingRule,
  deleteRoutingRule,
  dryRunRoutingRule,
} from "./routing_rules";

export type { SavedSearch } from "./saved_searches";
export {
  listSavedSearches,
  createSavedSearch,
  deleteSavedSearch,
} from "./saved_searches";

export type {
  DSGVOStatus,
  DSGVOMailStatus,
  DSGVOMailResult,
  DSGVOResultSummary,
  DSGVORequest,
  CreateDSGVORequestInput,
} from "./dsgvo";
export {
  getDSGVORequests,
  getDSGVORequest,
  createDSGVORequest,
  deleteDSGVODeletableMails,
  exportDSGVORequestPDF,
} from "./dsgvo";
