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

use crate::event::{RoomInfo, UserInfo};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MemberJoinedService {
    pub room: RoomInfo,
    pub user: UserInfo,
    pub project_role: Option<String>,
    pub joined_at: DateTime<Utc>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MemberRemovedService {
    pub room: RoomInfo,
    pub user: UserInfo,
    pub removed_by: UserInfo,
    pub removed_at: DateTime<Utc>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ReadReceiptService {
    pub room: RoomInfo,
    pub user: UserInfo,
    pub last_read_seq: i64,
    pub updated_at: DateTime<Utc>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TypingStartService {
    pub room: RoomInfo,
    pub user: UserInfo,
    pub sender_type: String,
    pub started_at: DateTime<Utc>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TypingStopService {
    pub room: RoomInfo,
    pub user: UserInfo,
    pub sender_type: String,
    pub stopped_at: DateTime<Utc>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DndUpdatedService {
    pub room: RoomInfo,
    pub user: UserInfo,
    pub do_not_disturb: bool,
    pub dnd_start_hour: Option<i32>,
    pub dnd_end_hour: Option<i32>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AccessGrantClient {
    pub room: RoomInfo,
    pub user: UserInfo,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AccessRevokeClient {
    pub room: RoomInfo,
    pub user: UserInfo,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ReadReceiptClient {
    pub room: RoomInfo,
    pub last_read_seq: i64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TypingStartClient {
    pub room: RoomInfo,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TypingStopClient {
    pub room: RoomInfo,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DndUpdateClient {
    pub room: RoomInfo,
    pub do_not_disturb: bool,
    pub dnd_start_hour: Option<i32>,
    pub dnd_end_hour: Option<i32>,
}
