using System;
using System.Collections.Generic;
using EcsRx.Entities;
namespace EcsRx.Groups.Observable
{
///
/// A maintained collection of entities which match a given group
///
///
/// Implements IEnumerable so you can just enumerate the entities within the group.
///
/// This is quite often going to be a cached list of entities which
/// is kept up to date based off events being reported, so it is often
/// more performant to use this rather than querying a collection directly.
/// This can change based upon implementations though.
///
public interface IObservableGroup : IReadOnlyList
{
///
/// The underlying token that is used to describe the group
///
///
/// The token contains both components required and the specific collection
/// it should be targetting if its been setup to only observe a given collection.
///
ObservableGroupToken Token { get; }
///
/// Event stream for when an entity has been added to this group
///
IObservable OnEntityAdded { get; }
///
/// Event stream for when an entity has been removed from this group
///
IObservable OnEntityRemoved { get; }
///
/// Event stream for when an entity is about to be removed from this group
///
IObservable OnEntityRemoving { get; }
///
/// Checks if the observable group contains a given entity
///
/// The Id of the entity you want to locate
/// true if it finds the entity, false if it cannot
bool ContainsEntity(int id);
IEntity GetEntity(int id);
}
}