Files
2026-06-26 10:29:23 +02:00

140 lines
4.4 KiB
C#

using System.Xml.Serialization;
using adas_core.Domain.Enums;
using MongoDB.Bson;
using Newtonsoft.Json;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents an observation or record related to configuration state.
/// </summary>
/// <remarks>
/// This type is intended to capture configuration-related observation data within the application.
/// </remarks>
public class ConfigObservation
{
public Dictionary<string, ConfigObservation>? Grouped;
public ObjectId Id { get; set; }
public string? Code { get; set; }
public string? CodingSystem { get; set; }
public string? OriginalName { get; set; }
public string? ParentCode { get; set; }
public string? ParentCodingSystem { get; set; }
public string? ParentName { get; set; }
public string? Name { get; set; }
public string? Units { get; set; }
public ObservationEnum.ArrowType ArrowType { get; set; } = ObservationEnum.ArrowType.Default;
public bool ShowArrow { get; set; } = true;
public bool ShowValue { get; set; } = true;
public bool ForceUnits { get; set; }
public double? MinAlert { get; set; }
public double? MaxAlert { get; set; }
public double? MaxWarn { get; set; }
public double? MinWarn { get; set; }
public string? WarnColor { get; set; }
public string? AlertColor { get; set; }
public List<object>? AlertValues { get; set; }
public List<object>? WarningValues { get; set; }
public bool ForceWarn { get; set; }
public bool ForceAlert { get; set; }
public char? Alert { get; set; }
public int? Expires { get; set; }
public bool ShowOnExpired { get; set; }
public bool? Persist { get; set; }
public string? ColorOnExpired { get; set; }
public RetentionPolicy? RetentionPolicy { get; set; }
public int? RetentionPolicyValue { get; set; }
public string? LevelCondition { get; set; }
public Dictionary<string, object>? UiConfiguration { get; set; }
public AlarmConfig? Alarm { get; set; }
public string? Description { get; set; }
public object? RequiredValue { get; set; }
public List<ConfigObservation>? Preconditions { get; set; }
public bool CheckObservations { get; set; }
public List<ConfigObservation>? CreateObservation { get; set; }
public ObservationEnum.InsertMode InsertMode { get; set; } = ObservationEnum.InsertMode.Auto;
public bool TimeFromMessageTime { get; set; } = false;
public List<ColorRange>? ColorRanges { get; set; }
public DemoConfig? DemoConfig { get; set; }
/// <summary>
/// Returns a JSON string representation of the current object with indented formatting,
/// overriding the default <see cref="object.ToString"/> behavior to provide a
/// human-readable serialization.
/// </summary>
/// <returns>A string containing the JSON-serialized representation of the object with indented formatting.</returns>
public override string ToString()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Represents a range of colors, typically used to define a spectrum or gradient between a start and end color.
/// </summary>
public class ColorRange
{
public ObservationEnum.ValueType? ValueType;
//Para números
public double? Min { get; set; }
public double? Max { get; set; }
//Para Strings
public string? MatchText { get; set; }
//Para booleanos
public bool? MatchBoolean { get; set; }
// Para fechas (en formato ISO)
public string? MinDate { get; set; }
public string? MaxDate { get; set; }
//Estética
public string? Color { get; set; }
public string? Label { get; set; }
}
}
/// <summary>
/// Represents a configuration class that holds settings for demonstration purposes.
/// </summary>
public class DemoConfig
{
public int? MaxValue { get; set; }
public int? MinValue { get; set; }
public object? ValueOption { get; set; }
public bool? SetRandomValue { get; set; }
public bool? SetInValue { get; set; }
public int? RandomCount { get; set; }
public bool? ValueIsArray { get; set; }
public bool? RequireInitDate { get; set; }
public bool? RequireEndDate { get; set; }
public int? PriorityAlarm { get; set; }
//Campos para el simulador del Admin
public int? Periodicity { get; set; }
public ObservationEnum.XmlType? XmlType { get; set; }
}