using Content.Shared.Access.Systems;
using Content.Shared.StationRecords;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
namespace Content.Shared.Access.Components;
///
/// Stores access levels necessary to "use" an entity
/// and allows checking if something or somebody is authorized with these access levels.
///
[RegisterComponent, NetworkedComponent]
public sealed class AccessReaderComponent : Component
{
///
/// The set of tags that will automatically deny an allowed check, if any of them are present.
///
[DataField("denyTags", customTypeSerializer: typeof(PrototypeIdHashSetSerializer))]
public HashSet DenyTags = new();
///
/// List of access lists to check allowed against. For an access check to pass
/// there has to be an access list that is a subset of the access in the checking list.
///
[DataField("access")]
public List> AccessLists = new();
///
/// A list of valid stationrecordkeys
///
[DataField("accessKeys")]
public HashSet AccessKeys = new();
}
[Serializable, NetSerializable]
public sealed class AccessReaderComponentState : ComponentState
{
public HashSet DenyTags;
public List> AccessLists;
public HashSet AccessKeys;
public AccessReaderComponentState(HashSet denyTags, List> accessLists, HashSet accessKeys)
{
DenyTags = denyTags;
AccessLists = accessLists;
AccessKeys = accessKeys;
}
}