import { Injectable, Logger } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; export interface PlantingStats { totalOrders: number; totalTrees: number; totalAmount: string; newUsers: number; activeUsers: number; } export interface RegionalPlantingStats extends PlantingStats { regionCode: string; regionName: string; } @Injectable() export class PlantingServiceClient { private readonly logger = new Logger(PlantingServiceClient.name); private readonly baseUrl: string; constructor(private readonly configService: ConfigService) { this.baseUrl = this.configService.get( 'PLANTING_SERVICE_URL', 'http://localhost:3003', ); } async getDailyStats(date: Date): Promise { this.logger.debug(`Fetching daily planting stats from ${this.baseUrl}`); // Mock data for development return { totalOrders: 0, totalTrees: 0, totalAmount: '0', newUsers: 0, activeUsers: 0, }; } async getStatsForDateRange( startDate: Date, endDate: Date, ): Promise { this.logger.debug( `Fetching planting stats for range ${startDate} - ${endDate} from ${this.baseUrl}`, ); return { totalOrders: 0, totalTrees: 0, totalAmount: '0', newUsers: 0, activeUsers: 0, }; } async getRegionalStats( regionCode: string, startDate: Date, endDate: Date, ): Promise { this.logger.debug( `Fetching regional planting stats for ${regionCode} from ${this.baseUrl}`, ); return { regionCode, regionName: '', totalOrders: 0, totalTrees: 0, totalAmount: '0', newUsers: 0, activeUsers: 0, }; } async getAllProvincesStats( startDate: Date, endDate: Date, ): Promise { this.logger.debug(`Fetching all provinces planting stats from ${this.baseUrl}`); return []; } async getAllCitiesStats( provinceCode: string, startDate: Date, endDate: Date, ): Promise { this.logger.debug( `Fetching all cities planting stats for province ${provinceCode} from ${this.baseUrl}`, ); return []; } }