using Content.Shared.Kitchen.EntitySystems;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Kitchen.Components;
///
/// Attached to a microwave that is currently in the process of cooking
///
[RegisterComponent]
[Access(typeof(MicrowaveSystem))]
[NetworkedComponent, AutoGenerateComponentState(fieldDeltas: true), AutoGenerateComponentPause]
public sealed partial class ActiveMicrowaveComponent : Component
{
///
/// Whether or not this microwave cooking process is malfunctioning.
///
[DataField, AutoNetworkedField]
public bool Malfunctioning;
///
/// The recipe we are currently cooking.
///
[DataField, AutoNetworkedField]
public PortionedRecipe? PortionedRecipe;
///
/// The total cooking time of this operation.
///
[DataField, AutoNetworkedField]
public float TotalTime;
///
/// The time that this microwave will finish cooking.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoNetworkedField, AutoPausedField]
public TimeSpan CookTimeEnd = TimeSpan.Zero;
///
/// The last time that this microwave updated its cooking cycle..
///
///
/// This is used to calculate how much heat to add to the microwave.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoNetworkedField, AutoPausedField]
public TimeSpan LastCookUpdated = TimeSpan.Zero;
///
/// The next time this microwave will update its cooking cycle.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoNetworkedField, AutoPausedField]
public TimeSpan NextCookUpdate = TimeSpan.Zero;
///
/// The next time we attempt to roll a malfunction.
///
///
/// Malfunctions are rolled on an interval and generate random effects, like lightning or microwave destruction.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoNetworkedField, AutoPausedField]
public TimeSpan NextMalfunction = TimeSpan.Zero;
}
///
/// Represents a specific quantity of a recipe to cook.
///
[Serializable, NetSerializable]
[DataDefinition]
public partial struct PortionedRecipe(ProtoId recipe, uint count)
{
///
/// The recipe to make.
///
[DataField]
public ProtoId Recipe = recipe;
///
/// The number of portions to make of this recipe.
///
[DataField]
public uint Count = count;
}