using Content.Shared.DeviceNetwork.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.DeviceNetwork.Components;
[RegisterComponent]
[NetworkedComponent]
[Access(typeof(SharedDeviceListSystem))]
public sealed class DeviceListComponent : Component
{
///
/// The list of devices can or can't connect to, depending on the field.
///
[DataField("devices")]
public HashSet Devices = new();
///
/// The limit of devices that can be linked to this device list.
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("deviceLimit")]
public int DeviceLimit = 32;
///
/// Whether the device list is used as an allow or deny list
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("isAllowList")]
public bool IsAllowList = true;
///
/// Whether this device list also handles incoming device net packets
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("handleIncoming")]
public bool HandleIncomingPackets = false;
}
[Serializable, NetSerializable]
public sealed class DeviceListComponentState : ComponentState
{
public readonly HashSet Devices;
public readonly bool IsAllowList;
public readonly bool HandleIncomingPackets;
public DeviceListComponentState(HashSet devices, bool isAllowList, bool handleIncomingPackets)
{
Devices = devices;
IsAllowList = isAllowList;
HandleIncomingPackets = handleIncomingPackets;
}
}