// Proto file representing the EDB Group class

syntax = "proto3";

// Package
package ansys.api.edb.v1;

// Imports
import "ansys/api/edb/v1/edb_messages.proto";
import "ansys/api/edb/v1/hierarchy_obj.proto";

// Group service definition
service GroupService {
  // Create a group
  rpc Create(ObjectNameInLayoutMessage) returns (EDBObjMessage) {}

  // Finds a group by name in the given layout
  rpc FindByName(ObjectNameInLayoutMessage) returns (EDBObjMessage) {}

  // Add a member to the group
  rpc AddMember(GroupModifyMemberMessage) returns (google.protobuf.Empty) {}

  // Remove a member from the group
  rpc RemoveMember(GroupModifyMemberMessage) returns (google.protobuf.Empty) {}

  // Ungroup this group
  rpc Ungroup(BoolPropertyMessage) returns (google.protobuf.Empty) {}

  // Get iterable for group members
  rpc GetMembers(EDBObjMessage) returns (EDBObjCollectionMessage) {}
  rpc StreamMembers(EDBObjMessage) returns (stream EDBObjCollectionMessage) {}

  // Get the type of the group
  rpc GetGroupType(EDBObjMessage) returns (GroupTypeMessage) {}
}

message GroupModifyMemberMessage {
  EDBObjMessage target = 1;
  EDBObjMessage member = 2;
}

message GroupTypeMessage {
  enum GroupType {
    GROUP = 0;
    COMPONENT = 1;
    STRUCTURE_3D = 2;
    VIA_GROUP = 3;
  }
  GroupType group_type = 1;
}