import { ConfigSingleton } from '../config/ConfigSingleton';
import { UnauthorizedError } from '../types/errors';
import { AuthTokenRepository } from '../repositories/AuthTokenRepository';

export class AuthValidatorFactory {
  static createEmployeeOtpValidator(): AuthTokenRepository {
    return new AuthTokenRepository();
  }

  static validateAttendanceApiKey(key: string | undefined): void {
    if (key !== ConfigSingleton.getInstance().attendanceApiKey) {
      throw new UnauthorizedError('Invalid attendance API key');
    }
  }

  static validateCalendarApiKey(key: string | undefined): boolean {
    return key === ConfigSingleton.getInstance().calendarApiKey;
  }
}
