using System.Numerics;
using Content.Server.DeltaV.Cargo.Systems;
using Content.Server.DeltaV.CartridgeLoader.Cartridges;
using Content.Shared.CartridgeLoader.Cartridges;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Timing;
namespace Content.Server.DeltaV.Cargo.Components;
[RegisterComponent, AutoGenerateComponentPause]
[Access(typeof(StockMarketSystem), typeof(StockTradingCartridgeSystem))]
public sealed partial class StationStockMarketComponent : Component
{
///
/// The list of companies you can invest in
///
[DataField]
public List Companies = [];
///
/// The list of shares owned by the station
///
[DataField]
public Dictionary StockOwnership = new();
///
/// The interval at which the stock market updates
///
[DataField]
public TimeSpan UpdateInterval = TimeSpan.FromSeconds(600); // 10 minutes
///
/// The timespan of next update.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextUpdate = TimeSpan.Zero;
///
/// The sound to play after selling or buying stocks
///
[DataField]
public SoundSpecifier ConfirmSound = new SoundPathSpecifier("/Audio/Effects/Cargo/ping.ogg");
///
/// The sound to play if the don't have access to buy or sell stocks
///
[DataField]
public SoundSpecifier DenySound = new SoundPathSpecifier("/Audio/Effects/Cargo/buzz_sigh.ogg");
// These work well as presets but can be changed in the yaml
[DataField]
public List MarketChanges =
[
new() { Chance = 0.86f, Range = new Vector2(-0.05f, 0.05f) }, // Minor
new() { Chance = 0.10f, Range = new Vector2(-0.3f, 0.2f) }, // Moderate
new() { Chance = 0.03f, Range = new Vector2(-0.5f, 1.5f) }, // Major
new() { Chance = 0.01f, Range = new Vector2(-0.9f, 4.0f) }, // Catastrophic
];
}
[DataDefinition]
public sealed partial class MarketChange
{
[DataField(required: true)]
public float Chance;
[DataField(required: true)]
public Vector2 Range;
}