// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.universalledger.v1;

import "google/api/field_behavior.proto";

option csharp_namespace = "Google.Cloud.UniversalLedger.V1";
option go_package = "cloud.google.com/go/universalledger/apiv1/universalledgerpb;universalledgerpb";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
option java_package = "com.google.cloud.universalledger.v1";
option php_namespace = "Google\\Cloud\\UniversalLedger\\V1";
option ruby_package = "Google::Cloud::UniversalLedger::V1";

// A singleton enumeration to represent the None value.
enum NoneValue {
  // The None value.
  NONE_VALUE_UNSPECIFIED = 0;
}

// An entity in the Universal Ledger network. All accounts are attached to an
// entity. The entity ID, also often referred to as the account ID, is unique
// and immutable across the network.
message Entity {
  // Output only. The ID assigned to the entity. This is assigned by the network
  // on account creation.
  string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Represents an amount of currency (i.e. money). Note that the denominated
// currency is not included in this message. The relevant currency is decided by
// the account that sends the transaction. Each account has a unique immutable
// currency associated to it.
message CurrencyValue {
  // Required. The number of minor units of the currency.
  //
  //
  // This smallest valid denomination is referred to as "minor units" and is
  // specified in [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html).
  // As an example, for USD, the value will be the number of cents and for GBP
  // it will be the number of pence. For the Japanese Yen which does not have a
  // minor unit, it will be the number of Yen.
  int64 value = 1 [(google.api.field_behavior) = REQUIRED];
}

// A list of strings.
message StringList {
  // Optional. The string values.
  repeated string value = 1 [(google.api.field_behavior) = OPTIONAL];
}

// A list of int64s.
message Int64List {
  // Optional. The int64 values.
  repeated int64 value = 1 [(google.api.field_behavior) = OPTIONAL];
}

// A list of booleans.
message BoolList {
  // Optional. The boolean values.
  repeated bool value = 1 [(google.api.field_behavior) = OPTIONAL];
}

// A list of dictionaries.
message DictList {
  // Optional. The DictValue values.
  repeated DictValue value = 1 [(google.api.field_behavior) = OPTIONAL];
}

// Indices map key to value. For example, `keys[0]` key maps to `values[0]`.
message DictValue {
  // Each key can be exactly one kind.
  oneof keys {
    // Optional. A list of boolean keys.
    BoolList bool_keys = 1 [(google.api.field_behavior) = OPTIONAL];

    // Optional. A list of string keys.
    StringList string_keys = 2 [(google.api.field_behavior) = OPTIONAL];

    // Optional. A list of int64 keys.
    Int64List int64_keys = 3 [(google.api.field_behavior) = OPTIONAL];
  }

  // Each value can be exactly one kind.
  oneof values {
    // Optional. A list of boolean values.
    BoolList bool_values = 4 [(google.api.field_behavior) = OPTIONAL];

    // Optional. A list of string values.
    StringList string_values = 5 [(google.api.field_behavior) = OPTIONAL];

    // Optional. A list of int64 values.
    Int64List int64_values = 6 [(google.api.field_behavior) = OPTIONAL];

    // Optional. Values are a list of nested dictionaries.
    DictList dict_values = 7 [(google.api.field_behavior) = OPTIONAL];
  }
}

// A concrete value of some type.
message Value {
  // The actual value.
  oneof value {
    // Optional. Represents a None value.
    NoneValue none_value = 1 [(google.api.field_behavior) = OPTIONAL];

    // Optional. A boolean value.
    bool bool_value = 2 [(google.api.field_behavior) = OPTIONAL];

    // Optional. An int64 value.
    int64 int64_value = 3 [(google.api.field_behavior) = OPTIONAL];

    // Optional. A string value.
    string string_value = 4 [(google.api.field_behavior) = OPTIONAL];

    // Optional. An account ID.
    string account_id = 5 [(google.api.field_behavior) = OPTIONAL];

    // Optional. A dictionary value.
    DictValue dict_value = 6 [(google.api.field_behavior) = OPTIONAL];
  }
}
