agrobot_base/AgroBase/OperationControl/Models/AlertaModel.cs

56 lines
1.6 KiB
C#
Raw Normal View History

2025-12-04 13:51:11 +00:00
using static AgroBase.Models.Enums;
namespace OperationControl.Models
{
public enum SeveridadeAlerta
{
Info,
Warning,
Error,
Critical
}
public class AlertaModel
{
public string Rover_ID { get; set; }
public SeveridadeAlerta Severidade { get; set; }
public T_Code Modulo { get; set; } // ex: "DIR", "SEN", "MOV"
public string? Mod_ID { get; set; } // ID
public string Mensagem { get; set; } // texto principal
public DateTime CriadoEm { get; set; }
public DateTime? AtualizadoEm { get; set; }
2025-12-04 13:51:11 +00:00
// Campo calculado para título (ex: "DIR — Falha no encoder")
public string Titulo
{
get
{
string mod = Mod_ID != null && Mod_ID != S_Code.sMOD.ToString()
? $"{Modulo} ({Mod_ID})"
: Modulo.ToString();
2026-03-20 02:03:07 +00:00
//return $"[{Rover_ID}] {mod} — {ResumoSeveridade}";
return $"{mod} — {ResumoSeveridade}";
2025-12-04 13:51:11 +00:00
}
}
// Ícone simples só pra dar cara
public string Icone => Severidade switch
{
SeveridadeAlerta.Warning => "⚠️",
SeveridadeAlerta.Error => "🛑",
SeveridadeAlerta.Critical => "🚨",
_ => ""
};
public string ResumoSeveridade => Severidade switch
{
SeveridadeAlerta.Warning => "Alerta",
SeveridadeAlerta.Error => "Falha",
SeveridadeAlerta.Critical => "Crítico",
_ => "Info"
};
}
}