syntax = "proto3";

package timetracking;

service TimeTrackingService {
  rpc RegisterUser(RegisterUserRequest) returns (RegisterUserResponse);
  rpc LoginUser(LoginUserRequest) returns (LoginUserResponse);
  rpc GetUser(GetUserRequest) returns (GetUserResponse);
  rpc CreateProject(CreateProjectRequest) returns (CreateProjectResponse);
  rpc StartWorkSession(StartWorkSessionRequest) returns (StartWorkSessionResponse);
  rpc StopWorkSession(StopWorkSessionRequest) returns (StopWorkSessionResponse);
  rpc GenerateReport(GenerateReportRequest) returns (GenerateReportResponse);
}

message RegisterUserRequest {
  string name = 1;
  string email = 2;
  string password = 3;
}

message RegisterUserResponse {
  string userId = 1;
  string message = 2;
}

message LoginUserRequest {
  string email = 1;
  string password = 2;
}

message LoginUserResponse {
  string token = 1;
}

message GetUserRequest {
  string userId = 1;
}

message GetUserResponse {
  string userId = 1;
  string name = 2;
  string email = 3;
}

message CreateProjectRequest {
  string name = 1;
  string clientId = 2;
  string description = 3;
}

message CreateProjectResponse {
  string projectId = 1;
  string message = 2;
}

message StartWorkSessionRequest {
  string userId = 1;
  string projectId = 2;
  string description = 3;
}

message StartWorkSessionResponse {
  string sessionId = 1;
}

message StopWorkSessionRequest {
  string sessionId = 1;
}

message StopWorkSessionResponse {
  string message = 1;
}

message GenerateReportRequest {
  repeated string userIds = 1;
  string startDate = 2;
  string endDate = 3;
  string projectId = 4;
}

message GenerateReportResponse {
  string reportId = 1;
  string generatedAt = 2;
  repeated WorkSession sessions = 3;
}

message WorkSession {
  string sessionId = 1;
  string userId = 2;
  string startTime = 3;
  string endTime = 4;
  string projectId = 5;
  string description = 6;
}
