import apiClient from '../apiClient';
import type { LoginRequestDto } from '../../models/dtos/Usuarios/LoginRequestDto';
import type { LoginResponseDto } from '../../models/dtos/Usuarios/LoginResponseDto';
import type { ChangePasswordRequestDto } from '../../models/dtos/Usuarios/ChangePasswordRequestDto'; // Importar DTO

const login = async (credentials: LoginRequestDto): Promise<LoginResponseDto> => {
    const response = await apiClient.post<LoginResponseDto>('/auth/login', credentials);
    return response.data;
};

const changePassword = async (data: ChangePasswordRequestDto): Promise<void> => {
    // No esperamos datos de vuelta, solo éxito (204) o error
    await apiClient.post('/auth/change-password', data);
};

const authService = {
    login,
    changePassword, // Exportar la nueva función
};

export default authService;