using System; using System.ComponentModel.DataAnnotations; using FinlyticAssets.Models; using FinlyticCore.Models.Assets; namespace FinlyticAssets.Entities; /// /// Represents the global synchronization and timing configurations for the Trade Republic asset scanner. /// public class Settings { /// /// Gets or sets the unique identifier for the settings record. /// [Key] public Guid Id { get; set; } /// /// Gets or sets a value indicating whether the very first full scan of all assets has been completed. /// Used to switch from fast initial discovery delays to stealthy incremental update delays. /// public bool FinishedInitialScan { get; set; } /// /// Gets or sets the minimum number of days to wait before an asset becomes eligible for re-validation. /// Combined with to achieve a flat 2-to-3-month rotation cycle. /// public int MinRandomUpdateDay { get; set; } = 60; /// /// Gets or sets the maximum number of days to wait before an asset must be re-validated (roughly 3 months). /// public int MaxRandomUpdateDay { get; set; } = 90; /// /// Gets or sets the earliest hour (0-23) of the day when background synchronization is allowed to execute. /// Prevents unusual nocturnal API traffic. /// public int UpdateDayTimeStart { get; set; } = 8; /// /// Gets or sets the latest hour (0-23) of the day when background synchronization is allowed to execute. /// public int UpdateDayTimeStop { get; set; } = 21; /// /// Gets or sets the maximum number of assets requested per single API pagination call. /// Values around 100 look like standard dynamic-scrolling payloads from a real client device. /// public int TradeRepublicMaxRequestPageSize { get; set; } = 100; /// /// Gets or sets the idle delay in seconds between switching from one full asset category to another (e.g., from Stocks to Crypto) /// during standard maintenance mode. (Default 12000s = ~3.3 hours). /// public int AssetUpdateTypeDelay { get; set; } = 12000; /// /// Gets or sets the idle delay in seconds between switching asset categories during the initial setup scan. /// Faster than standard mode but kept high enough to prevent early rate limiting. (Default 3600s = 1 hour). /// public int InitAssetUpdateTypeDelay { get; set; } = 3600; /// /// Gets or sets the baseline delay in seconds between sequential page requests of the same asset type during the initial setup scan. /// (Default 120s = 2 minutes). /// public int InitBatchAssetUpdateDelay { get; set; } = 120; /// /// Gets or sets the standard baseline delay in seconds between sequential page requests of the same asset type during recurring incremental updates. /// Spreads pagination widely over time to blend into regular human traffic profiles. (Default 600s = 10 minutes). /// public int BatchAssetUpdateDelay { get; set; } = 600; /// /// Gets or sets the asset type that is currently being processed by the full scan. /// Acts as a live pointer for recovery after a service interruption. /// public AssetType CurrentScanningType { get; set; } = AssetType.Stock; /// /// Gets or sets the page number of the that is currently being fetched or was just processed. /// Trade Republic uses 1-based pagination. A value of 0 means the scan is currently idle or between types. /// public int CurrentScanningPage { get; set; } = 0; }