//! Room membership rows stored in `athena.chat_room_members`.

use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};

use crate::ids::{MessageId, RoomId, UserId};

/// Membership of a user in a chat room with role and read state.
///
/// Maps to `athena.chat_room_members`; enforced by [`crate::repo::traits::ChatRepository`].
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RoomMember {
    pub room_id: RoomId,
    pub user_id: UserId,
    /// Member role: `owner`, `admin`, or `member`.
    pub role: String,
    pub joined_at: DateTime<Utc>,
    /// Highest `room_seq` the member has read.
    pub last_read_seq: i64,
    pub last_read_message_id: Option<MessageId>,
    pub muted: bool,
    pub notification_mode: Option<String>,
    /// Set when the member hides the room from their inbox.
    pub hidden_at: Option<DateTime<Utc>>,
}
