2019-09-06 08:12:44 +02:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2021-11-24 20:03:07 +13:00
|
|
|
using Content.Shared.Containers.ItemSlots;
|
2019-09-06 08:12:44 +02:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.Serialization;
|
2021-11-24 20:03:07 +13:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2019-09-06 08:12:44 +02:00
|
|
|
|
2021-12-16 23:42:02 +13:00
|
|
|
namespace Content.Shared.Access.Components
|
2019-09-06 08:12:44 +02:00
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public abstract class SharedIdCardConsoleComponent : Component
|
2019-09-06 08:12:44 +02:00
|
|
|
{
|
2021-10-24 19:28:25 +11:00
|
|
|
public const int MaxFullNameLength = 256;
|
|
|
|
|
public const int MaxJobTitleLength = 256;
|
|
|
|
|
|
2021-11-24 20:03:07 +13:00
|
|
|
[DataField("privilegedIdSlot")]
|
|
|
|
|
public ItemSlot PrivilegedIdSlot = new();
|
|
|
|
|
|
|
|
|
|
[DataField("targetIdSlot")]
|
|
|
|
|
public ItemSlot TargetIdSlot = new();
|
|
|
|
|
|
2019-09-06 08:12:44 +02:00
|
|
|
public enum UiButton
|
|
|
|
|
{
|
|
|
|
|
PrivilegedId,
|
|
|
|
|
TargetId,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class IdButtonPressedMessage : BoundUserInterfaceMessage
|
2019-09-06 08:12:44 +02:00
|
|
|
{
|
|
|
|
|
public readonly UiButton Button;
|
|
|
|
|
|
|
|
|
|
public IdButtonPressedMessage(UiButton button)
|
|
|
|
|
{
|
|
|
|
|
Button = button;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class WriteToTargetIdMessage : BoundUserInterfaceMessage
|
2019-09-06 08:12:44 +02:00
|
|
|
{
|
|
|
|
|
public readonly string FullName;
|
|
|
|
|
public readonly string JobTitle;
|
|
|
|
|
public readonly List<string> AccessList;
|
|
|
|
|
|
|
|
|
|
public WriteToTargetIdMessage(string fullName, string jobTitle, List<string> accessList)
|
|
|
|
|
{
|
|
|
|
|
FullName = fullName;
|
|
|
|
|
JobTitle = jobTitle;
|
|
|
|
|
AccessList = accessList;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class IdCardConsoleBoundUserInterfaceState : BoundUserInterfaceState
|
2019-09-06 08:12:44 +02:00
|
|
|
{
|
2019-10-21 22:54:16 +02:00
|
|
|
public readonly string PrivilegedIdName;
|
2019-09-06 08:12:44 +02:00
|
|
|
public readonly bool IsPrivilegedIdPresent;
|
|
|
|
|
public readonly bool IsPrivilegedIdAuthorized;
|
|
|
|
|
public readonly bool IsTargetIdPresent;
|
2019-10-21 22:54:16 +02:00
|
|
|
public readonly string TargetIdName;
|
2021-02-27 04:12:09 +01:00
|
|
|
public readonly string? TargetIdFullName;
|
|
|
|
|
public readonly string? TargetIdJobTitle;
|
|
|
|
|
public readonly string[]? TargetIdAccessList;
|
2019-09-06 08:12:44 +02:00
|
|
|
|
|
|
|
|
public IdCardConsoleBoundUserInterfaceState(bool isPrivilegedIdPresent,
|
|
|
|
|
bool isPrivilegedIdAuthorized,
|
|
|
|
|
bool isTargetIdPresent,
|
2021-02-27 04:12:09 +01:00
|
|
|
string? targetIdFullName,
|
|
|
|
|
string? targetIdJobTitle,
|
|
|
|
|
string[]? targetIdAccessList, string privilegedIdName, string targetIdName)
|
2019-09-06 08:12:44 +02:00
|
|
|
{
|
|
|
|
|
IsPrivilegedIdPresent = isPrivilegedIdPresent;
|
|
|
|
|
IsPrivilegedIdAuthorized = isPrivilegedIdAuthorized;
|
|
|
|
|
IsTargetIdPresent = isTargetIdPresent;
|
|
|
|
|
TargetIdFullName = targetIdFullName;
|
|
|
|
|
TargetIdJobTitle = targetIdJobTitle;
|
|
|
|
|
TargetIdAccessList = targetIdAccessList;
|
2019-10-21 22:54:16 +02:00
|
|
|
PrivilegedIdName = privilegedIdName;
|
|
|
|
|
TargetIdName = targetIdName;
|
2019-09-06 08:12:44 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum IdCardConsoleUiKey
|
|
|
|
|
{
|
|
|
|
|
Key,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|