namespace QuantEngine.Core.Interfaces;

public interface INormalizedLearningStore
{
    Task<Guid> AppendSourceObservationAsync(SourceObservationRecord record);
    Task<Guid> AppendFactorObservationAsync(FactorObservationRecord record);
    Task<Guid> AppendDecisionAsync(DecisionEventRecord record);
    Task AppendDecisionFactorEvidenceAsync(Guid decisionId, Guid factorObservationId, string role);
    Task AppendOutcomeAsync(OutcomeEvaluationRecord record);
}

public sealed record SourceObservationRecord(
    DateTimeOffset ObservedAt,
    string InstrumentId,
    string SourceName,
    string SourceVersion,
    string PayloadJson,
    string ProvenanceJson);

public sealed record FactorObservationRecord(
    Guid ObservationId,
    Guid FactorObservationId,
    string FactorId,
    string FactorVersion,
    DateTimeOffset ObservedAt,
    decimal? NumericValue,
    string? TextValue,
    string Gate,
    string ProvenanceJson);

public sealed record DecisionEventRecord(
    string DecisionKey,
    DateTimeOffset DecidedAt,
    string InstrumentId,
    string Action,
    string Gate,
    decimal? Score,
    string SourceVersion,
    string TraceJson,
    string ProvenanceJson);

public sealed record OutcomeEvaluationRecord(
    Guid DecisionId,
    int HorizonDays,
    DateTimeOffset EvaluatedAt,
    decimal? RealizedReturn,
    decimal? BenchmarkReturn,
    decimal? ExcessReturn,
    string OutcomeClass,
    string EvaluationGate,
    string ProvenanceJson);
