syntax = "proto3";

package yandex.cloud.iot.devices.v1;

import "google/protobuf/timestamp.proto";
import "yandex/cloud/validation.proto";

option go_package = "github.com/yandex-cloud/go-genproto/yandex/cloud/iot/devices/v1;devices";
option java_package = "yandex.cloud.api.iot.devices.v1";

// A registry. For more information, see [Registry](/docs/iot-core/concepts/index#registry).
message Registry {
  enum Status {
    STATUS_UNSPECIFIED = 0;

    // Registry is being created.
    CREATING = 1;

    // Registry is ready to use.
    ACTIVE = 2;

    // Registry is being deleted.
    DELETING = 3;
  }

  // ID of the registry.
  string id = 1;

  // ID of the folder that the registry belongs to.
  string folder_id = 2;

  // Creation timestamp.
  google.protobuf.Timestamp created_at = 3;

  // Name of the registry. The name is unique within the folder.
  string name = 4;

  // Description of the registry. 0-256 characters long.
  string description = 5;

  // Resource labels as `key:value` pairs. Maximum of 64 per resource.
  map<string, string> labels = 6;

  // Status of the registry.
  Status status = 7;

  // ID of the logs group for the specified registry.
  string log_group_id = 8;
}

// A registry certificate. For more information, see [Managing registry certificates](/docs/iot-core/operations/certificates/registry-certificates).
message RegistryCertificate {
  // ID of the registry that the certificate belongs to.
  string registry_id = 1;

  // SHA256 hash of the certificates.
  string fingerprint = 2;

  // Public part of the certificate.
  string certificate_data = 3;

  // Creation timestamp.
  google.protobuf.Timestamp created_at = 4;
}

// A device topic alias.
//
// Alias is an alternate name of a device topic assigned by the user. Map alias to canonical topic name prefix, e.g. `my/custom/alias` match to `$device/abcdef/events`. For more information, see [Using topic aliases](/docs/iot-core/concepts/topic#aliases).
message DeviceAlias {
  // ID of the device that the alias belongs to.
  string device_id = 1;

  // Prefix of a canonical topic name to be aliased, e.g. `$devices/abcdef`.
  string topic_prefix = 2;

  // Alias of a device topic.
  string alias = 3;
}

// A registry password.
message RegistryPassword {
  // ID of the registry that the password belongs to.
  string registry_id = 1;

  // ID of the password.
  string id = 2;

  // Creation timestamp.
  google.protobuf.Timestamp created_at = 3;
}
