'use server';
import { resolve } from '../../lib/server-container.js';
export async function listAttachments(workItemId) {
    try {
        const useCase = resolve('ListAttachmentsUseCase');
        const result = await useCase.execute(workItemId);
        return { attachments: result.attachments };
    }
    catch (error) {
        const message = error instanceof Error ? error.message : 'Failed to list attachments';
        return { error: message };
    }
}
export async function deleteAttachment(attachmentId) {
    try {
        const useCase = resolve('DeleteAttachmentUseCase');
        const result = await useCase.execute(attachmentId);
        if (!result.ok)
            return { error: result.error };
        return {};
    }
    catch (error) {
        const message = error instanceof Error ? error.message : 'Failed to delete attachment';
        return { error: message };
    }
}
