using Content.Shared.Guidebook;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Atmos.Piping.Binary.Components;
///
/// Defines a gas pressure regulator,
/// which releases gas depending on a set pressure threshold between two pipe nodes.
///
[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentState(true, true), AutoGenerateComponentPause]
public sealed partial class GasPressureRegulatorComponent : Component
{
///
/// Determines whether the valve is open or closed.
/// Used for showing the valve animation, the UI,
/// and on examine.
///
[DataField, AutoNetworkedField]
public bool Enabled;
///
/// Specifies the pipe node name to be treated as the inlet.
///
[DataField]
public string InletName = "inlet";
///
/// Specifies the pipe node name to be treated as the outlet.
///
[DataField]
public string OutletName = "outlet";
///
/// The max transfer rate of the pressure regulator.
///
[GuidebookData]
[DataField]
public float MaxTransferRate = Atmospherics.MaxTransferRate;
///
/// The server time at which the next UI update will be sent.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextUiUpdate = TimeSpan.Zero;
///
/// Sets the opening threshold of the pressure regulator.
///
/// If set to 500 kPa, the regulator will only
/// open if the pressure in the inlet side is above
/// 500 kPa.
[DataField, AutoNetworkedField]
public float Threshold;
///
/// How often the UI update is sent.
///
[DataField]
public TimeSpan UpdateInterval = TimeSpan.FromSeconds(1);
#region UI/Examine Info
///
/// The current flow rate of the pressure regulator.
///
[ViewVariables(VVAccess.ReadOnly)]
[DataField, AutoNetworkedField]
public float FlowRate;
///
/// Current inlet pressure the pressure regulator.
///
[ViewVariables(VVAccess.ReadOnly)]
[DataField, AutoNetworkedField]
public float InletPressure;
///
/// Current outlet pressure of the pressure regulator.
///
[ViewVariables(VVAccess.ReadOnly)]
[DataField, AutoNetworkedField]
public float OutletPressure;
#endregion
}