import { PoiDatasourceInf } from "../datasource/poi_datasource";
import { PointOfInterest } from "../datasource/api/entities/poi";
import { PoiRepositoryInf } from "../../domain/repository/poi_repository";

/**
 * Implementation of the PoiRepository interface for production.
 */
export class POIRepositoryProd implements PoiRepositoryInf {
  constructor(private datasouce: PoiDatasourceInf) {}

  /**
   * Registers a new point of interest.
   * @param form - The point of interest data to register.
   * @returns A promise that resolves when the point of interest is registered.
   */
  async registerPoint(form: PointOfInterest): Promise<void> {
    return this.datasouce.registerPoint(form);
  }

  /**
   * Retrieves a point of interest by its ID.
   * @param idPoint - The ID of the point of interest.
   * @returns A promise that resolves to a PointOfInterest object.
   */
  async getPOIById(idPoint: number): Promise<PointOfInterest> {
    return this.datasouce.getPOIById(idPoint);
  }

  /**
   * Retrieves points of interest by place.
   * @param idPlace - The ID of the place.
   * @returns A promise that resolves to an array of PointOfInterest objects.
   */
  async getPOIsByPlace(idPlace: number): Promise<PointOfInterest[]> {
    return this.datasouce.getPOIsByPlace(idPlace);
  }

  /**
   * Retrieves a PDF document for the given points of interest.
   * @param idPlace - The ID of the place.
   * @param pointsId - An array of point IDs.
   * @returns A promise that resolves to a string representing the PDF document.
   */
  async getPDFByPoints(idPlace: number, pointsId: number[]): Promise<string> {
    return this.datasouce.getPDFByPoints(idPlace, pointsId);
  }
}
