using System.Collections.Generic;
using AnalyticsDAL.DTO.Warehouse;
namespace AnalyticsDAL.DTO.AnalysisAggregation.V1
{
/// Describes one computed field actually evaluated for a RunBIQuery response —
/// carried on AnalysisResultMetaDTO.ComputedFieldsUsed. Deliberately has NO Expression
/// property: Meta ships to every browser on every query; the raw formula is admin
/// configuration and belongs on the admin-facing MBIFIELDMAPPING picker response, not here.
public class AnalysisComputedFieldDTO
{
public string Field { get; set; } = "";
public string Label { get; set; } = "";
public byte DataType { get; set; }
public List SourceFields { get; set; } = new();
/// Always NonAdditive — a computed field is never safe to re-aggregate at a
/// coarser grain, even when every source it references is Additive (the operators
/// involved, e.g. Abs()/IIf(), are non-linear: Abs(a)+Abs(b) != Abs(a+b)).
public AdditivityType Additivity { get; set; } = AdditivityType.NonAdditive;
/// The most restrictive additivity among SourceFields — diagnostic only (e.g.
/// lets a reviewer see at a glance that a computed field derives from a SemiAdditive
/// balance), not itself used to gate anything.
public AdditivityType InheritedAdditivity { get; set; } = AdditivityType.Additive;
/// Rows where evaluation yielded null (divide-by-zero, bad cast) — surfaces a
/// formula that silently nulls every row instead of leaving it mysterious.
public int NullRowCount { get; set; }
}
}