pibtool_stock_data/
document_metadata.rs

1// SPDX-FileCopyrightText: Politik im Blick developers
2// SPDX-FileCopyrightText: Wolfgang Silbermayr <wolfgang@silbermayr.at>
3//
4// SPDX-License-Identifier: AGPL-3.0-or-later OR EUPL-1.2
5
6use serde::{Deserialize, Serialize};
7use url::Url;
8
9use super::DocumentKind;
10
11/// The metadata information for a downloaded document.
12#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
13pub struct DocumentMetadata {
14    /// The year in which the document was created.
15    pub year: usize,
16
17    /// The file name of the document.
18    pub filename: String,
19
20    /// The label of the document.
21    pub label: String,
22
23    /// The URL from which the document was downloaded.
24    pub url: Url,
25
26    /// The file size of the document (in bytes).
27    pub filesize: usize,
28
29    /// The kind of the document, if it can be detected with certainty.
30    #[serde(default, skip_serializing_if = "Option::is_none")]
31    pub document_kind: Option<DocumentKind>,
32}