use serde::{Deserialize, Serialize};
use crate::{FileId, PeerId};
/// TODO: docs
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct FileDeleted {
deleted_by: PeerId,
id: FileId,
}
impl FileDeleted {
/// Returns the [`PeerId`] of the peer that deleted the file.
#[inline(always)]
pub fn deleted_by(&self) -> PeerId {
self.deleted_by
}
/// Returns the [`FileId`] of the deleted file.
///
/// If the `FileId` belongs to a [`Directory`](crate::FileKind::Directory)
/// file, it means all its children were also deleted.
#[inline(always)]
pub fn file_id(&self) -> FileId {
self.id
}
}