use derive_builder::Builder;

#[derive(Debug, Builder)]
#[cfg_attr(test, derive(PartialEq, Clone))]
pub struct RemoteVisitorDataFilter {
    #[builder(default = "true")]
    pub visitor_code: bool,
    #[builder(default = "1")]
    pub previous_visit_amount: u32,
    #[builder(default = "true")]
    pub current_visit: bool,
    #[builder(default = "true")]
    pub custom_data: bool,
    #[builder(default = "false")]
    pub conversions: bool,
    #[builder(default = "false")]
    pub experiments: bool,
    #[builder(default = "false")]
    pub page_views: bool,
    #[builder(default = "false")]
    pub geolocation: bool,
    #[builder(default = "false")]
    pub device: bool,
    #[builder(default = "false")]
    pub browser: bool,
    #[builder(default = "false")]
    pub operating_system: bool,
    #[builder(default = "false")]
    pub kcs: bool,
    #[builder(default = "false")]
    pub personalizations: bool,
    #[builder(default = "false")]
    pub cbs: bool,
}

impl Default for RemoteVisitorDataFilter {
    fn default() -> Self {
        return RemoteVisitorDataFilterBuilder::default().build().unwrap();
    }
}

#[cfg(test)]
pub struct RemoteVisitorDataFilterUtils {}

#[cfg(test)]
impl RemoteVisitorDataFilterUtils {
    pub fn make(
        previous_visit_amount: u32,
        current_visit: bool,
        custom_data: bool,
        page_views: bool,
        geolocation: bool,
        device: bool,
        browser: bool,
        operating_system: bool,
        conversions: bool,
        experiments: bool,
        kcs: bool,
        visitor_code: bool,
        personalizations: bool,
        cbs: bool,
    ) -> RemoteVisitorDataFilter {
        RemoteVisitorDataFilterBuilder::default()
            .previous_visit_amount(previous_visit_amount)
            .current_visit(current_visit)
            .custom_data(custom_data)
            .page_views(page_views)
            .geolocation(geolocation)
            .device(device)
            .browser(browser)
            .operating_system(operating_system)
            .conversions(conversions)
            .experiments(experiments)
            .kcs(kcs)
            .visitor_code(visitor_code)
            .personalizations(personalizations)
            .cbs(cbs)
            .build()
            .expect("RemoteVisitorDataFilterBuilder failed")
    }
}
