syntax = "proto3";

package coresdk.external_data;
option ruby_package = "Temporalio::Internal::Bridge::Api::ExternalData";

import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

// This file defines data that Core might write externally. The first motivating case being
// storing data in markers in event history. Defining such data as protos provides an easy way
// for consumers which would like to just depend on the proto package to make sense of marker data.

message LocalActivityMarkerData {
  uint32 seq = 1;
  // The number of attempts at execution before we recorded this result. Typically starts at 1,
  // but it is possible to start at a higher number when backing off using a timer.
  uint32 attempt = 2;
  string activity_id = 3;
  string activity_type = 4;
  // You can think of this as "perceived completion time". It is the time the local activity thought
  // it was when it completed. Which could be different from wall-clock time because of workflow
  // replay. It's the WFT start time + the LA's runtime
  google.protobuf.Timestamp complete_time = 5;
  // If set, this local activity conceptually is retrying after the specified backoff.
  // Implementation wise, they are really two different LA machines, but with the same type & input.
  // The retry starts with an attempt number > 1.
  google.protobuf.Duration backoff = 6;
  // The time the LA was originally scheduled (wall clock time). This is used to track
  // schedule-to-close timeouts when timer-based backoffs are used
  google.protobuf.Timestamp original_schedule_time = 7;
}

message PatchedMarkerData {
  // The patch id
  string id = 1;
  // Whether or not the patch is marked deprecated.
  bool deprecated = 2;
}