syntax = "proto3";
package task;

import "google/protobuf/wrappers.proto";
import "google/protobuf/empty.proto";

import "core_shared.proto";

option go_package = "com.github/quabynah-bilson/proche;core";

// TaskService is the service that handles task related operations
service TaskService {
  // task related operations
  rpc create_task(core.CreateTaskRequest) returns (core.ProcheTask);
  rpc get_task(google.protobuf.StringValue) returns (stream core.ProcheTask);
  rpc get_tasks(core.CommonAddress) returns (stream core.TaskList);
  rpc get_tasks_for_current_user(google.protobuf.Empty) returns (stream core.TaskList);
  rpc update_task(core.UpdateTaskRequest) returns (core.ProcheTask);
  rpc delete_task(google.protobuf.StringValue) returns (google.protobuf.Empty);

  // task event related operations
  rpc create_task_event(core.CreateTaskEventRequest) returns (core.TaskEvent);
  rpc get_task_event(google.protobuf.StringValue) returns (stream core.TaskEvent);
  rpc get_task_events(google.protobuf.StringValue) returns (stream core.TaskEventList);
  rpc cancel_task_event(google.protobuf.StringValue) returns (core.TaskEvent);
  rpc complete_task_event(core.CompleteTaskEventRequest) returns (core.TaskEvent);
  rpc get_task_events_for_user(google.protobuf.StringValue) returns (stream core.TaskEventList);
  rpc get_task_events_for_task(google.protobuf.StringValue) returns (stream core.TaskEventList);
  rpc get_task_events_for_user_and_task(core.TaskEventRequest) returns (stream core.TaskEventList);
  rpc delete_task_event(google.protobuf.StringValue) returns (google.protobuf.Empty);
  rpc delete_task_events_for_task(google.protobuf.StringValue) returns (google.protobuf.Empty);
  rpc delete_task_events_for_user(google.protobuf.StringValue) returns (google.protobuf.Empty);
  rpc delete_task_events_for_user_and_task(core.TaskEventRequest) returns (google.protobuf.Empty);

  // candidates
  rpc get_candidates_for_task(google.protobuf.StringValue) returns (stream core.TaskCandidateList);
  rpc apply_for_task(core.ApplyForTaskRequest) returns (google.protobuf.Empty);
}