import { Controller, Get, Param, NotFoundException } from '@nestjs/common';
import { DeliveryTrackingService } from './services/delivery-tracking.service';

@Controller('track')
export class PublicTrackingController {
  constructor(private readonly trackingService: DeliveryTrackingService) {}

  @Get(':orderId')
  async getPublicTracking(@Param('orderId') orderId: string) {
    try {
      return await this.trackingService.getPublicTracking(orderId);
    } catch {
      throw new NotFoundException('Tracking information not found');
    }
  }
}
