// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.

syntax = "proto3";
option go_package = "storj.io/common/pb";

package node;

import "gogo.proto";
import "google/protobuf/timestamp.proto";
import "noise.proto";

// Node represents a serialized NodeURL. A NodeURL should be able to be
// converted to a pb.Node and vice versa.
message Node {
    bytes id = 1 [(gogoproto.customtype) = "NodeID", (gogoproto.nullable) = false];
    NodeAddress address = 2;

    reserved 3 to 14;
    reserved "type", "restrictions", "reputation", "metadata", "latency_list", "audit_success", "is_up", "update_latency", "update_audit_success", "update_uptime", "version", "last_ip", "deprecated_last_ip";
}

// NodeType is an enum of possible node types.
enum NodeType {
    option deprecated = true;
    INVALID = 0;
    STORAGE = 2;

    reserved 1, 3, 4;
    reserved "SATELLITE", "UPLINK", "BOOTSTRAP";
}

// NodeAddress contains the information needed to communicate with a node on
// the network.
message NodeAddress {
    string address = 2;

    noise.NoiseInfo noise_info = 3;

    // the number of concurrent identical messages this node knows how to
    // debounce. restricted to a specific protocol (e.g. just TLS or just Noise).
    int32 debounce_limit = 4;

    enum Feature {
        NO_FEATURES = 0;

        // these must all be powers of two, since they are bitwise ORed into
        // the features field.
        TCP_FASTOPEN_ENABLED = 1;
    }
    uint64 features = 5;

    reserved 1;
    reserved "transport";
}

// NodeTransport is an enum of possible transports for the overlay network.
enum NodeTransport {
    TCP_TLS_RPC = 0;
    QUIC_RPC = 1;
    TCP_NOISE_RPC = 2;
}

// NodeOperator contains info about the storage node operator.
message NodeOperator {
    string email = 1;
    string wallet = 2;
    repeated string wallet_features = 3;
}

// NodeCapacity contains all relevant data about a nodes ability to store data.
message NodeCapacity {
    int64 free_bandwidth = 1 [deprecated=true];
    int64 free_disk = 2;
}

// Deprecated: use NodeOperator instead.
message NodeMetadata {
    string email = 1;
    string wallet = 2;
}

// Deprecated: use NodeCapacity instead.
message NodeRestrictions {
    int64 free_bandwidth = 1;
    int64 free_disk = 2;
}

// NodeVersion contains version information about a node.
message NodeVersion {
    string version = 1; // must be semver formatted
    string commit_hash = 2;
    google.protobuf.Timestamp timestamp = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
    bool release = 4;
}
