'use server';
import { resolve } from '../../lib/server-container.js';
export async function loginUser(input) {
    try {
        const useCase = resolve('LoginUserUseCase');
        const result = await useCase.execute(input);
        if (!result.ok)
            return { error: result.error };
        return { user: result.user, session: result.session };
    }
    catch (error) {
        const message = error instanceof Error ? error.message : 'Failed to login';
        return { error: message };
    }
}
