using Content.Server.Ame.EntitySystems;
using Content.Shared.Ame.Components;
using Content.Shared.Containers.ItemSlots;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Ame.Components;
///
/// The component used to make an entity the controller/fuel injector port of an AntiMatter Engine.
/// Connects to adjacent entities with this component or to make an AME.
///
[Access(typeof(AmeControllerSystem), typeof(AmeNodeGroup))]
[RegisterComponent]
public sealed partial class AmeControllerComponent : SharedAmeControllerComponent
{
///
/// Antimatter fuel slot.
///
[DataField("fuelSlot")]
[ViewVariables(VVAccess.ReadWrite)]
public ItemSlot FuelSlot = new();
///
/// Whether or not the AME controller is currently injecting animatter into the reactor.
///
[DataField("injecting")]
[ViewVariables(VVAccess.ReadWrite)]
public bool Injecting = false;
///
/// How much antimatter the AME controller is set to inject into the reactor per update.
///
[DataField("injectionAmount")]
[ViewVariables(VVAccess.ReadWrite)]
public int InjectionAmount = 2;
///
/// How stable the reactor currently is.
/// When this falls to <= 0 the reactor explodes.
///
[DataField("stability")]
[ViewVariables(VVAccess.ReadWrite)]
public int Stability = 100;
///
/// The sound used when pressing buttons in the UI.
///
[DataField("clickSound")]
[ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier ClickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
///
/// The sound used when injecting antimatter into the AME.
///
[DataField("injectSound")]
[ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier InjectSound = new SoundPathSpecifier("/Audio/Machines/ame_fuelinjection.ogg");
///
/// The last time this could have injected fuel into the AME.
///
[DataField("lastUpdate")]
public TimeSpan LastUpdate = default!;
///
/// The next time this will try to inject fuel into the AME.
///
[DataField("nextUpdate")]
public TimeSpan NextUpdate = default!;
///
/// The next time this will try to update the controller UI.
///
public TimeSpan NextUIUpdate = default!;
///
/// The the amount of time that passes between injection attempts.
///
[DataField("updatePeriod")]
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan UpdatePeriod = TimeSpan.FromSeconds(10.0);
///
/// The maximum amount of time that passes between UI updates.
///
[ViewVariables]
public TimeSpan UpdateUIPeriod = TimeSpan.FromSeconds(3.0);
///
/// Time at which the admin alarm sound effect can next be played.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan EffectCooldown;
///
/// Time between admin alarm sound effects. Prevents spam
///
[DataField]
public TimeSpan CooldownDuration = TimeSpan.FromSeconds(10f);
}