/**
 * LocalGreenChain Database Service Layer
 * Central export for all database operations
 */

// Prisma client singleton
export { default as prisma, prisma as db } from './prisma';

// Types and utilities
export * from './types';

// User operations
export * as users from './users';
export {
  createUser,
  getUserById,
  getUserByEmail,
  getUserByWalletAddress,
  updateUser,
  deleteUser,
  getUsers,
  getUsersByType,
  updateLastLogin,
  searchUsers,
  getUserWithPlants,
  getUserWithFarms,
  getUserStats,
} from './users';

// Plant operations
export * as plants from './plants';
export {
  createPlant,
  getPlantById,
  getPlantWithOwner,
  getPlantWithLineage,
  updatePlant,
  updatePlantStatus,
  deletePlant,
  getPlants,
  getPlantsByOwner,
  getNearbyPlants,
  searchPlants,
  getPlantLineage,
  clonePlant,
  getPlantNetworkStats,
  updatePlantBlockchain,
} from './plants';

// Transport operations
export * as transport from './transport';
export {
  createTransportEvent,
  getTransportEventById,
  getTransportEventWithDetails,
  updateTransportEvent,
  updateTransportEventStatus,
  deleteTransportEvent,
  getTransportEvents,
  getTransportEventsByPlant,
  getPlantJourney,
  getEnvironmentalImpact,
  getUserCarbonFootprint,
  createSeedBatch,
  getSeedBatchById,
  createHarvestBatch,
  getHarvestBatchById,
} from './transport';

// Vertical farm operations
export * as farms from './farms';
export {
  createVerticalFarm,
  getVerticalFarmById,
  getVerticalFarmWithZones,
  updateVerticalFarm,
  updateFarmStatus,
  deleteVerticalFarm,
  getVerticalFarms,
  getVerticalFarmsByOwner,
  createGrowingZone,
  getGrowingZoneById,
  getGrowingZoneWithBatch,
  updateGrowingZone,
  updateZoneStatus,
  deleteGrowingZone,
  getGrowingZonesByFarm,
  updateZoneEnvironment,
  createCropBatch,
  getCropBatchById,
  getCropBatchWithDetails,
  updateCropBatch,
  updateCropBatchStatus,
  deleteCropBatch,
  getCropBatches,
  getActiveCropBatchesByFarm,
  addCropBatchIssue,
  createGrowingRecipe,
  getGrowingRecipeById,
  getGrowingRecipesByCrop,
  incrementRecipeUsage,
  recordResourceUsage,
  getResourceUsage,
  recordFarmAnalytics,
  getFarmAnalytics,
} from './farms';

// Demand and market operations
export * as demand from './demand';
export {
  upsertConsumerPreference,
  getConsumerPreference,
  getNearbyConsumerPreferences,
  createDemandSignal,
  getDemandSignalById,
  getDemandSignals,
  getActiveDemandSignals,
  createSupplyCommitment,
  getSupplyCommitmentById,
  updateSupplyCommitment,
  reduceCommitmentQuantity,
  getSupplyCommitments,
  findMatchingSupply,
  createMarketMatch,
  getMarketMatchById,
  getMarketMatchWithDetails,
  updateMarketMatchStatus,
  getMarketMatches,
  createSeasonalPlan,
  getSeasonalPlanById,
  updateSeasonalPlan,
  updateSeasonalPlanStatus,
  getSeasonalPlansByGrower,
  createDemandForecast,
  getLatestDemandForecast,
  createPlantingRecommendation,
  getPlantingRecommendations,
} from './demand';

// Audit and blockchain operations
export * as audit from './audit';
export {
  createAuditLog,
  getAuditLogs,
  getEntityAuditLogs,
  getUserAuditLogs,
  getAuditLogsSummary,
  createBlockchainBlock,
  getBlockchainBlockByIndex,
  getBlockchainBlockByHash,
  getLatestBlockchainBlock,
  getBlockchainBlocks,
  verifyBlockchainIntegrity,
  getBlockchainStats,
  logEntityChange,
} from './audit';
