Files
beau-gosse-du-92/src/domain/model/store_interface.rs
2024-06-27 08:25:11 +02:00

56 lines
1.3 KiB
Rust

use std::rc::Rc;
use async_trait::async_trait;
use super::{
common::Avatar,
room::{Invitation, RoomId},
room_member::RoomMember,
space::SpaceId,
};
#[allow(dead_code)]
pub trait AccountStoreConsumerInterface {}
pub trait AccountStoreProviderInterface {
fn on_new_room(
&self,
room: Rc<dyn RoomStoreConsumerInterface>,
) -> Rc<dyn RoomStoreProviderInterface>;
fn on_new_space(
&self,
space: Rc<dyn SpaceStoreConsumerInterface>,
) -> Rc<dyn SpaceStoreProviderInterface>;
}
#[async_trait(?Send)]
pub trait RoomStoreConsumerInterface {
fn id(&self) -> &RoomId;
fn is_direct(&self) -> Option<bool>;
fn name(&self) -> Option<String>;
fn topic(&self) -> Option<String>;
#[allow(dead_code)]
async fn avatar(&self) -> Option<Avatar>;
fn spaces(&self) -> &Vec<SpaceId>;
}
pub trait RoomStoreProviderInterface {
fn on_new_name(&self, name: Option<String>);
fn on_new_avatar(&self, avatar: Option<Avatar>);
fn on_new_topic(&self, topic: Option<String>);
fn on_new_member(&self, member: RoomMember);
fn on_invitation(&self, invitation: Invitation);
}
#[allow(dead_code)]
pub trait SpaceStoreConsumerInterface {
fn id(&self) -> &SpaceId;
fn name(&self) -> Option<String>;
}
pub trait SpaceStoreProviderInterface {
fn set_name(&self, _name: Option<String>) {}
}