/*
** Copyright 2022 Centreon
**
** 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.
**
** For more information : contact@centreon.com
*/

syntax = "proto3";

package com.centreon.broker;

/**
 * @brief A tag is a generalization of a host group or a service group. It
 * is a way to group resources. It has an id, a type and a name.
 *
 * Because a tag can be sent from several poller, and by moment a poller can
 * say it does not need it anymore, broker needs to know from which poller the
 * tag event comes from, so we have a poller_id in the message.
 *
 * For example, two pollers use a tag named 'foo'. Then the first one sends a
 * Tag message with the action DELETE. This means this poller does not need it
 * anymore but we don't know about the other poller. Then we can remove
 * relations between resources of our poller and this tag. And only if the tag
 * is no more used at all, we can remove it.
 */
enum TagType {
  SERVICEGROUP = 0;
  HOSTGROUP = 1;
  SERVICECATEGORY = 2;
  HOSTCATEGORY = 3;
}

message Tag {
  uint64 id = 1;
  enum Action {
    ADD = 0;
    DELETE = 1;
    MODIFY = 2;
  }

  Action action = 2;
  TagType type = 3;
  string name = 4;
  int64 poller_id = 5;
}

message TagInfo {
  uint64 id = 1;
  TagType type = 2;
}
