/*
 * Copyright (C) 2019 Open Source Robotics Foundation
 *
 * 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 gz.sim.private_msgs;

import "gz/msgs/header.proto";

/// \brief Holds information about a peer in the network.
message PeerInfo
{
  /// \brief Optional header data
  gz.msgs.Header header = 1;

  /// \brief ID of the peer
  string id = 2;

  /// \brief Hostname of the peer
  string hostname = 3;

  /// \brief Possible roles for a peer
  enum PeerRole
  {
    /// \brief No role in the network
    NONE = 0;

    /// \brief Read-only role, not executing simulation
    READ_ONLY = 1;

    /// \brief Configures and assigns work to secondaries
    SIMULATION_PRIMARY = 2;

    /// \brief Receives work from primary and executes
    SIMULATION_SECONDARY = 3;
  };

  /// \brief This peer's role in the network
  PeerRole role = 4;
};

/// \brief Notify a peer's state to the network.
message PeerAnnounce
{
  /// \brief General information about the peer
  PeerInfo info = 1;

  /// \brief Possible states announced by a peer
  enum PeerState
  {
    /// \brief Peer is connecting right now
    CONNECTING = 0;

    /// \brief Peer is disconnecting right now
    DISCONNECTING = 1;
  };

  /// \brief State which the peer is announcing
  PeerState state = 2;
};
