using Content.Shared.Storage.EntitySystems;
using Content.Shared.Whitelist;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Storage.Components;
///
/// This is used for things like paper bins, in which
/// you can only take off of the top of the bin.
///
[RegisterComponent, NetworkedComponent, Access(typeof(BinSystem))]
public sealed partial class BinComponent : Component
{
///
/// The containers that contain the items held in the bin
///
[ViewVariables]
public Container ItemContainer = default!;
///
/// A list representing the order in which
/// all the entities are stored in the bin.
///
///
/// The only reason this isn't a stack is so that
/// i can handle entities being deleted and removed
/// out of order by other systems
///
[DataField("items")]
public List Items = new();
///
/// The items that start in the bin. Sorted in order.
///
[DataField("initialContents", customTypeSerializer: typeof(PrototypeIdListSerializer))]
public List InitialContents = new();
///
/// A whitelist governing what items can be inserted into the bin.
///
[DataField("whitelist")]
public EntityWhitelist? Whitelist;
///
/// The maximum amount of items
/// that can be stored in the bin.
///
[DataField("maxItems")]
public int MaxItems = 20;
}
[Serializable, NetSerializable]
public sealed class BinComponentState : ComponentState
{
public List Items;
public EntityWhitelist? Whitelist;
public int MaxItems;
public BinComponentState(List items, EntityWhitelist? whitelist, int maxItems)
{
Items = items;
Whitelist = whitelist;
MaxItems = maxItems;
}
}