import { Injectable } from '@nestjs/common';
import { Employee } from '@prisma/client';
import { PrismaService } from 'src/core/database/prisma.service';

@Injectable()
export class EmployeeRepository {
  constructor(private readonly prisma: PrismaService) {}

  async findById(employeeId: string): Promise<Employee> {
    return await this.prisma.employee.findUnique({ where: { id: employeeId } });
  }

  async findByPersonnelNumber(personnelNumber: string): Promise<Employee> {
    return await this.prisma.employee.findFirst({ where: { personnelNumber } });
  }
}
