syntax = "proto3";

package temporal.api.cloud.account.v1;

option go_package = "go.temporal.io/api/cloud/account/v1;account";
option java_package = "io.temporal.api.cloud.account.v1";
option java_multiple_files = true;
option java_outer_classname = "MessageProto";
option ruby_package = "Temporalio::Api::Cloud::Account::V1";
option csharp_namespace = "Temporalio.Api.Cloud.Account.V1";

import "temporal/api/cloud/resource/v1/message.proto";
import "temporal/api/cloud/sink/v1/message.proto";

message MetricsSpec {
    // The ca cert(s) in PEM format that clients connecting to the metrics endpoint can use for authentication.
    // This must only be one value, but the CA can have a chain.
    bytes accepted_client_ca = 2;
}

message AccountSpec {
    // The metrics specification for this account.
    // If not specified, metrics will not be enabled.
    MetricsSpec metrics = 1;
}

message Metrics {
    // The prometheus metrics endpoint uri.
    // This is only populated when the metrics is enabled in the metrics specification.
    string uri = 1;
}

message Account {
    // The id of the account.
    string id = 1;
    // The account specification.
    AccountSpec spec = 2;
    // The current version of the account specification.
    // The next update operation will have to include this version.
    string resource_version = 3;
    // The current state of the account.
    temporal.api.cloud.resource.v1.ResourceState state = 4;
    // The id of the async operation that is updating the account, if any.
    string async_operation_id = 5;
    // Information related to metrics.
    Metrics metrics = 6;
}

// AuditLogSinkSpec is only used by Audit Log
message AuditLogSinkSpec {
  // Name of the sink e.g. "audit_log_01"
  string name = 1;

  oneof sink_type {
    // The KinesisSpec when destination_type is Kinesis
    api.cloud.sink.v1.KinesisSpec kinesis_sink = 2;

    // The PubSubSpec when destination_type is PubSub
    api.cloud.sink.v1.PubSubSpec pub_sub_sink = 3;
  }

  // Enabled indicates whether the sink is enabled or not.
  bool enabled = 4;
}
