use magnetar_model::ck;

pub trait BaseId: 'static {
    fn get_id(&self) -> &str;
}

macro_rules! impl_id {
    ($id:ty) => {
        impl BaseId for $id {
            fn get_id(&self) -> &str {
                &self.id
            }
        }
    };
}

impl_id!(ck::emoji::Model);
impl_id!(ck::user::Model);
impl_id!(ck::note::Model);
impl_id!(ck::notification::Model);

impl BaseId for ck::poll::Model {
    fn get_id(&self) -> &str {
        &self.note_id
    }
}
