using System; using System.Collections.Generic; using System.Collections.ObjectModel; using Gestor.Model.Attributes; using Gestor.Model.Domain.Generic; using Gestor.Model.Helper; using Gestor.Model.Resources; using Newtonsoft.Json; namespace Gestor.Model.Domain.Seguros; public class Status : DomainBase, IDomain { private string _nome; [Log(true)] [Name(true)] public string Nome { get { return _nome?.ToUpper(); } set { _nome = value; } } [Log(true)] public bool Ativo { get; set; } [JsonIgnore] public Func>> ValidationEvent => Validate; public List> Validate() { List> list = ValidationHelper.AddValue(); if (string.IsNullOrWhiteSpace(Nome)) { list.AddValue("Nome", Messages.Obrigatorio); } else if (Nome.Length > 60) { list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 60)); } return list; } public List Log() { return new List { new TupleList { Tuples = new ObservableCollection> { new Tuple("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""), new Tuple("ATIVO", Ativo ? "SIM" : "NÃO", "") } } }; } }