defmodule Com.Github.TraceMachina.Nativelink.RemoteExecution.KeepAliveRequest do
  @moduledoc false

  use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3

  field :worker_id, 1, type: :string, json_name: "workerId"
end

defmodule Com.Github.TraceMachina.Nativelink.RemoteExecution.GoingAwayRequest do
  @moduledoc false

  use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3

  field :worker_id, 1, type: :string, json_name: "workerId"
end

defmodule Com.Github.TraceMachina.Nativelink.RemoteExecution.ConnectWorkerRequest do
  @moduledoc false

  use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3

  field :properties, 1, repeated: true, type: Build.Bazel.Remote.Execution.V2.Platform.Property
  field :worker_id_prefix, 2, type: :string, json_name: "workerIdPrefix"
end

defmodule Com.Github.TraceMachina.Nativelink.RemoteExecution.ExecuteResult do
  @moduledoc false

  use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3

  oneof :result, 0

  field :worker_id, 1, type: :string, json_name: "workerId"
  field :instance_name, 6, type: :string, json_name: "instanceName"
  field :operation_id, 8, type: :string, json_name: "operationId"

  field :execute_response, 4,
    type: Build.Bazel.Remote.Execution.V2.ExecuteResponse,
    json_name: "executeResponse",
    oneof: 0

  field :internal_error, 5, type: Google.Rpc.Status, json_name: "internalError", oneof: 0
end

defmodule Com.Github.TraceMachina.Nativelink.RemoteExecution.ConnectionResult do
  @moduledoc false

  use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3

  field :worker_id, 1, type: :string, json_name: "workerId"
end

defmodule Com.Github.TraceMachina.Nativelink.RemoteExecution.KillOperationRequest do
  @moduledoc false

  use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3

  field :operation_id, 1, type: :string, json_name: "operationId"
end

defmodule Com.Github.TraceMachina.Nativelink.RemoteExecution.UpdateForWorker do
  @moduledoc false

  use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3

  oneof :update, 0

  field :connection_result, 1,
    type: Com.Github.TraceMachina.Nativelink.RemoteExecution.ConnectionResult,
    json_name: "connectionResult",
    oneof: 0

  field :keep_alive, 2, type: Google.Protobuf.Empty, json_name: "keepAlive", oneof: 0

  field :start_action, 3,
    type: Com.Github.TraceMachina.Nativelink.RemoteExecution.StartExecute,
    json_name: "startAction",
    oneof: 0

  field :disconnect, 4, type: Google.Protobuf.Empty, oneof: 0

  field :kill_operation_request, 5,
    type: Com.Github.TraceMachina.Nativelink.RemoteExecution.KillOperationRequest,
    json_name: "killOperationRequest",
    oneof: 0
end

defmodule Com.Github.TraceMachina.Nativelink.RemoteExecution.StartExecute do
  @moduledoc false

  use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3

  field :execute_request, 1,
    type: Build.Bazel.Remote.Execution.V2.ExecuteRequest,
    json_name: "executeRequest"

  field :operation_id, 4, type: :string, json_name: "operationId"
  field :queued_timestamp, 3, type: Google.Protobuf.Timestamp, json_name: "queuedTimestamp"
  field :platform, 5, type: Build.Bazel.Remote.Execution.V2.Platform
  field :worker_id, 6, type: :string, json_name: "workerId"
end

defmodule Com.Github.TraceMachina.Nativelink.RemoteExecution.HistoricalExecuteResponse do
  @moduledoc false

  use Protobuf, protoc_gen_elixir_version: "0.14.1", syntax: :proto3

  field :action_digest, 1, type: Build.Bazel.Remote.Execution.V2.Digest, json_name: "actionDigest"

  field :execute_response, 3,
    type: Build.Bazel.Remote.Execution.V2.ExecuteResponse,
    json_name: "executeResponse"
end

defmodule Com.Github.TraceMachina.Nativelink.RemoteExecution.WorkerApi.Service do
  @moduledoc false

  use GRPC.Service,
    name: "com.github.trace_machina.nativelink.remote_execution.WorkerApi",
    protoc_gen_elixir_version: "0.14.1"

  rpc :ConnectWorker,
      Com.Github.TraceMachina.Nativelink.RemoteExecution.ConnectWorkerRequest,
      stream(Com.Github.TraceMachina.Nativelink.RemoteExecution.UpdateForWorker)

  rpc :KeepAlive,
      Com.Github.TraceMachina.Nativelink.RemoteExecution.KeepAliveRequest,
      Google.Protobuf.Empty

  rpc :GoingAway,
      Com.Github.TraceMachina.Nativelink.RemoteExecution.GoingAwayRequest,
      Google.Protobuf.Empty

  rpc :ExecutionResponse,
      Com.Github.TraceMachina.Nativelink.RemoteExecution.ExecuteResult,
      Google.Protobuf.Empty
end

defmodule Com.Github.TraceMachina.Nativelink.RemoteExecution.WorkerApi.Stub do
  @moduledoc false

  use GRPC.Stub, service: Com.Github.TraceMachina.Nativelink.RemoteExecution.WorkerApi.Service
end
