import { Injectable } from '@nestjs/common';
import { AttendanceRegistrationRepository } from './attendance-registration.repository';
import { AttendanceRegistration } from '@prisma/client';
import { Interval } from 'date-fns';
import { AttendanceRegistrationEvents } from './attendance-registration-events.enum';

@Injectable()
export class AttendanceRegistrationService {
  constructor(private readonly repository: AttendanceRegistrationRepository) {}

  async findById(
    attendanceRegistrationId: number,
  ): Promise<AttendanceRegistration> {
    return this.repository.findById(attendanceRegistrationId);
  }

  async findInInterval(
    interval: Interval,
    eventTypes: AttendanceRegistrationEvents[],
  ): Promise<AttendanceRegistration[]> {
    return this.repository.findInInterval(interval, eventTypes);
  }

  async findByEmployeeInInterval(
    employeeId: number,
    interval: Interval,
    eventTypes: AttendanceRegistrationEvents[],
  ): Promise<AttendanceRegistration[]> {
    return this.repository.findByEmployeeInInterval(
      employeeId,
      interval,
      eventTypes,
    );
  }
}
