use crate::data::keyed::Keyed;

#[derive(Debug)]
#[cfg_attr(test, derive(PartialEq))]
pub(crate) struct Personalization {
    pub(crate) id: u32,
    // pub(crate) variation_id: u32,
}

impl Personalization {
    pub(crate) fn new(id: u32 /* , variation_id: u32*/) -> Self {
        return Personalization {
            id, /* , variation_id */
        };
    }
}

impl Keyed<u32> for Personalization {
    fn key(&self) -> &u32 {
        return &self.id;
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_new() {
        const ID: u32 = 123;
        let personalization = Personalization::new(ID);
        assert_eq!(ID, personalization.id);
        // assert_eq!(VAR_ID, personalization.variation_id);
    }

    #[test]
    fn test_key() {
        const ID: u32 = 98;
        let personalization = Personalization::new(ID);
        assert_eq!(ID, *personalization.key());
    }
}
