using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Research.Components;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ResearchServerComponent : Component
{
///
/// The name of the server
///
[AutoNetworkedField]
[DataField("serverName"), ViewVariables(VVAccess.ReadWrite)]
public string ServerName = "RDSERVER";
///
/// The amount of points on the server.
///
[AutoNetworkedField]
[DataField("points"), ViewVariables(VVAccess.ReadWrite)]
public int Points;
///
/// A unique numeric id representing the server
///
[AutoNetworkedField]
[ViewVariables(VVAccess.ReadOnly)]
public int Id;
///
/// Entities connected to the server
///
///
/// This is not safe to read clientside
///
[ViewVariables(VVAccess.ReadOnly)]
public List Clients = new();
[DataField("nextUpdateTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextUpdateTime = TimeSpan.Zero;
[DataField("researchConsoleUpdateTime"), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan ResearchConsoleUpdateTime = TimeSpan.FromSeconds(1);
}
///
/// Event raised on a server's clients when the point value of the server is changed.
///
///
///
///
[ByRefEvent]
public readonly record struct ResearchServerPointsChangedEvent(EntityUid Server, int Total, int Delta);
///
/// Event raised every second to calculate the amount of points added to the server.
///
///
///
[ByRefEvent]
public record struct ResearchServerGetPointsPerSecondEvent(EntityUid Server, int Points);