syntax = "proto3";

package next_edu_cloud.msg.v1;

service NotificationService {
  rpc SendNotification(SendNotificationRequest) returns (Notification);
  rpc ListNotifications(ListNotificationsRequest) returns (ListNotificationsResponse);
  rpc MarkAsRead(MarkAsReadRequest) returns (Empty);
  rpc SearchNotifications(SearchNotificationsRequest) returns (SearchNotificationsResponse);
}

message Notification {
  string id = 1;
  string user_id = 2;
  string type = 3;
  string title = 4;
  string content = 5;
  string channel = 6;
  bool is_read = 7;
  int64 created_at = 8;
}

message SendNotificationRequest {
  string user_id = 1;
  string type = 2;
  string title = 3;
  string content = 4;
  string channel = 5;
}

message ListNotificationsRequest {
  string user_id = 1;
  bool only_unread = 2;
}

message ListNotificationsResponse {
  repeated Notification notifications = 1;
}

message MarkAsReadRequest { string id = 1; }
message SearchNotificationsRequest {
  string user_id = 1;
  string query = 2;
}
message SearchNotificationsResponse {
  repeated Notification notifications = 1;
}
message Empty {}
