addAttachment

suspend fun addAttachment(filePath: String, attachmentName: String, module: String, moduleUid: String, type: ZyncAttachmentType, description: String?, tagUids: List<String>?, latitude: Double?, longitude: Double?): AttachmentOperationResult

Add a new attachment to the system. This method reads the file from the provided path, copies it to the app-specific directory, calculates its hash, and stores the attachment information in the database.

Return

AttachmentOperationResult containing the created Attachment object or error

Parameters

filePath

URI to the source file to be added. Must be a valid URI with scheme: - File URI: "file:///storage/emulated/0/..." (Android) or "file:///var/mobile/..." (iOS) - Content URI: "content://media/picker/..." (Android photo picker - requires Android context) Note: Plain file system paths without URI schemes are not accepted. Content URIs are Android-specific and will fail gracefully on iOS.

attachmentName

Name of the attachment. If this looks like a URI segment (especially for content URIs), the manager will attempt to auto-detect the proper display name from the ContentResolver.

module

Module this attachment belongs to (e.g., "job", "customer")

moduleUid

UID of the module instance

type

attachment classification (e.g., "NOTE", "SIGNATURE", etc)

description

Optional description of the attachment

tagUids

Optional list of tag UIDs to associate with the attachment

latitude

Optional latitude coordinate for geo-tagging the attachment

longitude

Optional longitude coordinate for geo-tagging the attachment