import '../../domain/models/attendance_login_request.dart';
import '../../domain/models/attendance_logout_request.dart';
import '../../domain/models/attendance_response_model.dart';
import '../../domain/repositories/attendance_repository.dart';
import '../datasources/attendance_remote_data_source.dart';

class AttendanceRepositoryImpl implements AttendanceRepository {
  final AttendanceRemoteDataSource remoteDataSource;

  AttendanceRepositoryImpl({required this.remoteDataSource});

  @override
  Future<AttendanceResponseModel> login(AttendanceLoginRequest request) async {
    final dto = await remoteDataSource.login(
      employeeId: request.employeeId,
      faceImage: request.faceImage,
    );

    return AttendanceResponseModel(
      id: dto.id,
      employeeId: dto.employeeId,
      login: dto.login,
    );
  }

  @override
  Future<AttendanceResponseModel> logout(
    AttendanceLogoutRequest request,
  ) async {
    final dto = await remoteDataSource.logout(
      employeeId: request.employeeId,
      faceImage: request.faceImage,
    );

    return AttendanceResponseModel(
      id: dto.id,
      employeeId: dto.employeeId,
      logout: dto.logout,
    );
  }
}
