pibtool_stock_data/data_source/
city_leonding_data_source.rs

1// SPDX-FileCopyrightText: Politik im Blick developers
2// SPDX-FileCopyrightText: amdoku <aqpoba@gmail.com>
3//
4// SPDX-License-Identifier: AGPL-3.0-or-later OR EUPL-1.2
5
6use std::collections::BTreeMap;
7
8use serde::{Deserialize, Serialize};
9use url::Url;
10
11use crate::DocumentKind;
12
13use super::DataSourceInfo;
14
15/// The CityLinz data source.
16#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
17pub struct CityLeondingDataSource {
18    /// The entry url for the data source.
19    pub url: Url,
20
21    /// The kinds of documents provided by the data source.
22    pub contained_documents: BTreeMap<DocumentKind, BTreeMap<String, String>>,
23}
24
25impl DataSourceInfo for CityLeondingDataSource {
26    fn is_download_supported(&self) -> bool {
27        true
28    }
29
30    fn provides_documents(&self, document_kind: DocumentKind) -> bool {
31        self.contained_documents.keys().any(|k| k == &document_kind)
32    }
33}