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 serde::Deserialize;
use std::collections::HashMap;

pub type Domain = String;
pub type Medium = String;
pub type Source = String;

#[derive(Debug, Clone)]
pub struct Referer {
    pub source: Source,
    pub medium: Medium,
    pub params: Vec<String>,
}

#[derive(Deserialize)]
pub struct Referers {
    #[serde(flatten)]
    pub data: HashMap<Medium, HashMap<Source, RefSource>>,
}

#[derive(Deserialize)]
pub struct RefSource {
    pub domains: Vec<String>,
    pub parameters: Option<Vec<String>>,
}