use super::DittoAttachment;

#[derive(Debug)]

/// A representation of the events that can occur in relation to an attachment fetch.
///
/// There are three different attachment fetch events: `Completed`, `Progress`, or `Deleted`.
///
/// There will be at most one `completed` or `deleted` event per attachment fetch. There can be many
/// `progress` events delivered for each attachment fetch.
///
/// Updates relating to an attachment fetch are delivered by registering a `DittoAttachmentFetcher`
/// through a call to [`fetch_attachment`](crate::store::collection::Collection::fetch_attachment)
pub enum DittoAttachmentFetchEvent {
    /// An attachment fetch event used when the attachment's download has
    /// completed.
    Completed { attachment: DittoAttachment },
    /// An attachment fetch event used when the attachment's download has
    /// progressed but is not yet complete.
    Progress {
        downloaded_bytes: u64,
        total_bytes: u64,
    },
    /// An attachment fetch event used when the attachment is deleted.
    Deleted,
}
