syntax = "proto2";

import "proto/common.proto";

option java_package = "com.android.asuite.clearcut";

// Proto used by Atest CLI Tool for External Non-PII Users
message AtestLogEventExternal {

  // ------------------------
  // EVENT DEFINITIONS
  // ------------------------
  // Occurs immediately upon execution of atest
  message AtestStartEvent {
  }

  // Occurs when atest exits for any reason
  message AtestExitEvent {
    optional Duration duration = 1;
    optional int32 exit_code = 2;
  }

  // Occurs after a SINGLE test reference has been resolved to a test or
  // not found
  message FindTestFinishEvent {
    optional Duration duration = 1;
    optional bool success = 2;
  }

  // Occurs after the build finishes, either successfully or not.
  message BuildFinishEvent {
    optional Duration duration = 1;
    optional bool success = 2;
  }

  // Occurs when a single test runner has completed
  message RunnerFinishEvent {
    optional Duration duration = 1;
    optional bool success = 2;
    optional string runner_name = 3;
  }

  // Occurs after all test runners and tests have finished
  message RunTestsFinishEvent {
    optional Duration duration = 1;
  }

  // Occurs after detection of catching bug by atest have finished
  message LocalDetectEvent {
    optional int32 detect_type = 1;
    optional int32 result = 2;
  }

  // ------------------------
  // FIELDS FOR ATESTLOGEVENT
  // ------------------------
  optional string user_key = 1;
  optional string run_id = 2;
  optional UserType user_type = 3;
  optional string tool_name = 10;
  oneof event {
    AtestStartEvent atest_start_event = 4;
    AtestExitEvent atest_exit_event = 5;
    FindTestFinishEvent find_test_finish_event= 6;
    BuildFinishEvent build_finish_event = 7;
    RunnerFinishEvent runner_finish_event = 8;
    RunTestsFinishEvent run_tests_finish_event = 9;
    LocalDetectEvent local_detect_event = 11;
  }
}