using System;
using System.Collections.Generic;
using EcsRx.Components;
namespace EcsRx.Entities
{
///
/// A container for components, its only job is to let you compose components
///
public interface IEntity : IDisposable
{
///
/// Triggered every time components are added to the entity
///
///
/// If you are adding components individually it will be fired once per interaction, its better to batch them
///
IObservable ComponentsAdded { get; }
///
/// Triggered every time components are about to be removed from the entity
///
///
/// If you are removing components individually it will be fired once per interaction, its better to batch them
///
IObservable ComponentsRemoving { get; }
///
/// Triggered every time components have been removed removed from the entity
///
///
/// If you are removing components individually it will be fired once per interaction, its better to batch them
///
IObservable ComponentsRemoved { get; }
///
/// The Id of the entity
///
///
/// It is recommended you do not pass entities around and instead pass their ids around
/// and then use the collection/observable group methods to get the entity from its id
///
int Id { get; }
///
/// All the components which have been applied to this entity
///
IEnumerable Components { get; }
IReadOnlyList ComponentAllocations { get; }
///
/// Removes component types from the entity
///
/// The component types to remove
void RemoveComponents(params Type[] componentsTypes);
///
/// Removes all the components from the entity
///
void RemoveAllComponents();
///
/// Gets a component from the entity based upon its type or null if one cannot be found
///
/// The type of component to retrieve
/// The component instance if found, or null if not
IComponent GetComponent(Type componentType);
///
/// Gets a component from the entity based upon its component type id
///
/// The id of the component type
/// The component instance if found, or null if not
IComponent GetComponent(int componentTypeId);
ref T GetComponent(int componentTypeId) where T : IComponent;
ref T AddComponent(int componentTypeId) where T : IComponent, new();
void UpdateComponent(int componentTypeId, T newValue) where T : struct, IComponent;
///
/// Checks to see if the entity contains the given component type
///
/// Type of component to look for
/// true if the component can be found, false if it cant be
bool HasComponent(Type componentType);
///
/// Checks to see if the entity contains the given component based on its type id
///
/// Type id of component to look for
/// true if the component can be found, false if it cant be
bool HasComponent(int componentTypeId);
void AddComponents(IReadOnlyList components);
void RemoveComponents(IReadOnlyList componentsTypeIds);
}
}