syntax = "proto3";

package next_edu_cloud.events.v1;

// Cross-service event contracts published by CoreEdu via the transactional
// outbox pattern and consumed by downstream services (notifications, analytics,
// audit, etc.). Topics follow the convention edu.{domain}.events.
//
// Event routing (TOPIC_MAP in outbox.publisher.ts):
//   edu.exam.events       <- exam.created / exam.updated / exam.deleted
//   edu.homework.events   <- homework.assigned / homework.submitted / homework.graded
//   edu.grade.events      <- grade.recorded / grade.updated
//   edu.class.events      <- class.transferred

message ClassEvent {
  string event_id = 1;
  string aggregate_id = 2;
  string event_type = 3;
  int64 occurred_at = 4;
  string class_id = 5;
  string name = 6;
  string action = 7;
  map<string, string> metadata = 8;
}

message ExamEvent {
  string event_id = 1;
  string aggregate_id = 2;
  string event_type = 3;
  int64 occurred_at = 4;
  string exam_id = 5;
  string class_id = 6;
  string title = 7;
  string action = 8;
  map<string, string> metadata = 9;
}

message HomeworkEvent {
  string event_id = 1;
  string aggregate_id = 2;
  string event_type = 3;
  int64 occurred_at = 4;
  string homework_id = 5;
  string class_id = 6;
  string title = 7;
  string action = 8;
  map<string, string> metadata = 9;
}

message GradeEvent {
  string event_id = 1;
  string aggregate_id = 2;
  string event_type = 3;
  int64 occurred_at = 4;
  string grade_id = 5;
  string student_id = 6;
  string score = 7;
  string action = 8;
  map<string, string> metadata = 9;
}
