import { Injectable } from '@nestjs/common';
import { PlannedTime } from '@prisma/client';
import { Interval } from 'date-fns';
import { PlannedTimeRepository } from './planned-time.repository';

@Injectable()
export class PlannedTimeService {
  constructor(private readonly repository: PlannedTimeRepository) {}

  async findById(id: string): Promise<PlannedTime> {
    return this.repository.findById(id);
  }

  async findByPersonnelNumberInInterval(
    personnelNumber: string,
    interval: Interval,
  ): Promise<PlannedTime[]> {
    return this.repository.findByPersonnelNumberInInterval(
      personnelNumber,
      interval,
    );
  }

  async findByOrdinanceTypesInInterval(
    ordinanceType: string | undefined,
    interval: Interval,
  ): Promise<PlannedTime[]> {
    return this.repository.findByOrdinanceTypesInInterval(
      ordinanceType,
      interval,
    );
  }
}
