// A file picked to attach — from the camera, the library or the files — // staged on this device where the store can copy it from // (`AttachmentSources`). import CottonKit import Foundation /// A file on this device to attach, staged where the store can copy it from. /// Whoever staged it deletes it once the attach answers. struct AttachmentSource: Equatable, Sendable { /// Which of the three it was picked from. enum Origin: Equatable, Sendable { case camera, library, files } let url: URL let mime: String let kind: CaptureMediaKind /// The staged file's own name — what `capture.media` is told for all /// three. let filename: String? let origin: Origin init(url: URL, mime: String, kind: CaptureMediaKind, filename: String?, origin: Origin) { self.url = url self.mime = mime self.kind = kind self.filename = filename self.origin = origin } /// The name a photo or file COLUMN keeps the pick under: only a file from /// the files has a name a person gave it; a staged camera or library copy /// is named by the app, and the column always kept those unnamed. var columnName: String? { origin == .files ? filename : nil } } /// The words a picked attachment's own menu says. enum AttachmentWords { /// What taking a picture off says (`DockPictures`). static let remove = "Remove" }