1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use crate::types::file::{self, id::AsFileId};
use serde::Deserialize;

/// Represents a [`PassportFile`][docs].
///
/// [docs]: https://core.telegram.org/bots/api#passportfile
#[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize)]
#[non_exhaustive]
pub struct File {
    /// The ID of the file.
    pub id: file::Id,
    /// The size of the file.
    pub size: usize,
    /// The date of the file.
    pub date: i64,
}

impl crate::internal::Sealed for File {}

impl AsFileId for File {
    #[must_use]
    fn as_file_id(&self) -> file::id::Ref<'_> {
        self.id.as_ref()
    }
}