syntax = "proto3";

package next_edu_cloud.classes.v1;

// ClassService 定义班级域 CRUD 契约
// P1: REST 实现，P3 起转 gRPC
service ClassService {
  rpc CreateClass(CreateClassRequest) returns (Class);
  rpc GetClass(GetClassRequest) returns (Class);
  rpc ListClasses(ListClassesRequest) returns (ListClassesResponse);
  rpc UpdateClass(UpdateClassRequest) returns (Class);
  rpc DeleteClass(DeleteClassRequest) returns (Empty);
}

message Class {
  string id = 1;
  string name = 2;
  string grade_id = 3;
  string head_teacher_id = 4;
  string description = 5;
  int64 created_at = 6;
  int64 updated_at = 7;
}

message CreateClassRequest {
  string name = 1;
  string grade_id = 2;
  string head_teacher_id = 3;
  string description = 4;
}

message GetClassRequest {
  string id = 1;
}

message ListClassesRequest {
  string grade_id = 1;
  int32 page_size = 2;
  string page_token = 3;
}

message ListClassesResponse {
  repeated Class classes = 1;
  string next_page_token = 2;
}

message UpdateClassRequest {
  string id = 1;
  optional string name = 2;
  optional string head_teacher_id = 3;
  optional string description = 4;
}

message DeleteClassRequest {
  string id = 1;
}

message Empty {}