using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace FinlyticEngine.Database.Entities;
///
/// Minimal per-cycle audit record for OpportunityPollerBackgroundService: which technical top-picks
/// FinlyticTechnicals returned for a given scan cycle, before ITradeLifecycleService.EvaluateAssetAsync
/// was called for each of them. This intentionally captures only the ENGINE-SIDE candidate set (the
/// already-filtered ta_GetSetups response, capped by and
/// ) - not the full FinlyticTechnicals scan universe (favorites/discovery/
/// sentiment-spike ISINs it monitors before that filter is even applied). See the Task 3 findings in the
/// implementing task report for why the broader, pre-filter universe is out of scope here: it lives entirely
/// inside FinlyticTechnicals (TechnicalUniverseManager), which this task was not scoped to touch.
///
[Table("engine_scan_cycles")]
public class EngineScanCycleEntity
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public DateTime CycleStartedAtUtc { get; set; } = DateTime.UtcNow;
/// The Limit the poller requested from FinlyticTechnicals' ta_GetSetups for this cycle.
public int RequestedLimit { get; set; }
/// The MinScore the poller requested from FinlyticTechnicals' ta_GetSetups for this cycle, if any.
[Column(TypeName = "decimal(6,2)")]
public decimal? RequestedMinScore { get; set; }
/// Number of candidates FinlyticTechnicals actually returned (i.e. CandidateIsins.Count).
public int CandidatesReturnedCount { get; set; }
///
/// ISINs of the technical top-picks returned for this cycle - exactly the set
/// OpportunityPollerBackgroundService went on to call EvaluateAssetAsync for, in the order
/// FinlyticTechnicals returned them (best quality-score first). Persisted as a JSON array (see
/// EngineDbContext's List<string> value converter) rather than a delimited string, so it
/// stays a real typed collection on this side of the mapping (Rules.md ยง3).
///
public List CandidateIsins { get; set; } = new();
}