agrobot_base/AgroBase/OperationControl/Models/AlertaModel.cs

56 lines
1.6 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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; }
// 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();
//return $"[{Rover_ID}] {mod} — {ResumoSeveridade}";
return $"{mod} — {ResumoSeveridade}";
}
}
// Í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"
};
}
}