using Content.Shared.Cargo.Prototypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Cargo;
///
/// A data structure for storing historical information about bounties.
///
[DataDefinition, NetSerializable, Serializable]
public readonly partial record struct CargoBountyHistoryData
{
///
/// A unique id used to identify the bounty
///
[DataField]
public string Id { get; init; } = string.Empty;
///
/// Whether this bounty was completed or skipped.
///
[DataField]
public BountyResult Result { get; init; } = BountyResult.Completed;
///
/// Optional name of the actor that completed/skipped the bounty.
///
[DataField]
public string? ActorName { get; init; } = default;
///
/// Time when this bounty was completed or skipped
///
[DataField]
public TimeSpan Timestamp { get; init; } = TimeSpan.MinValue;
///
/// The prototype containing information about the bounty.
///
[DataField(required: true)]
public ProtoId Bounty { get; init; } = string.Empty;
public CargoBountyHistoryData(CargoBountyData bounty, BountyResult result, TimeSpan timestamp, string? actorName)
{
Bounty = bounty.Bounty;
Result = result;
Id = bounty.Id;
ActorName = actorName;
Timestamp = timestamp;
}
///
/// Covers how a bounty was actually finished.
///
public enum BountyResult
{
///
/// Bounty was actually fulfilled and the goods sold
///
Completed = 0,
///
/// Bounty was explicitly skipped by some actor
///
Skipped = 1,
}
}