using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace gehGassiApp.Domain.Common { /// /// App-User-Blockierung mit Namen aufgelöst /// public class AppUserBlockWithNames { /// /// Id der Blockierung /// public long Id { get; set; } /// /// Id des App-Users der die Blockierung erstellt hat /// public string BlockingAppUserId { get; set; } /// /// Id des App-Users der blockiert wurde /// public string? BlockedAppUserId { get; set; } /// /// Wie lange ist die Blockierung gültig? /// Wenn null, dann dauerhaft /// public DateTimeOffset? BlockedUntil { get; set; } /// /// Optional: Verweis auf einen AppUserReport /// public long? AppUserReportId { get; set; } /// /// Erstellt von? /// public string CreatedBy { get; set; } /// /// Wann wurde die Blockierung erstellt? /// public DateTimeOffset Created { get; set; } /// /// Art des App-Users /// public AppUserType Type { get; set; } /// /// Vorname /// public string FirstName { get; set; } /// /// Nachname /// public string LastName { get; set; } /// /// Optional - Foto des Benutzers /// public string Photo { get; set; } /// /// Hinweis auf den Ort wo jemand zu Hause ist /// public string LocationHint { get; set; } /// /// Breitengrad der Adresse /// public double Lat { get; set; } /// /// Längengrad der Adresse /// public double Lng { get; set; } /// /// Distanz zum Lookup /// public double Distance { get; set; } /// /// Gesperrt /// public bool Locked { get; set; } /// /// Gesperrt /// public bool Deleted { get; set; } /// /// Gibt die Initialien zurück /// public string Initials { get { if (!string.IsNullOrWhiteSpace(FirstName) && !string.IsNullOrWhiteSpace(LastName)) return $"{FirstName.Substring(0, 1)}{LastName.Substring(0, 1)}"; else if (!string.IsNullOrWhiteSpace(FirstName) && FirstName.Length >= 2 && string.IsNullOrWhiteSpace(LastName)) return $"{FirstName.Substring(0, 2)}"; else if (string.IsNullOrWhiteSpace(FirstName) && string.IsNullOrWhiteSpace(LastName) && LastName.Length >= 2) return $"{LastName.Substring(0, 2)}"; else return "??"; } } /// /// Voller Name /// public string FullName => $"{FirstName} {LastName}"; /// /// Vorname + Nachname erster Buchstabe + Punkt, oder nur Vorname wenn kein Nachname /// public string FullNameShort => string.IsNullOrWhiteSpace(LastName) ? FirstName : $"{FirstName} {LastName[..1]}."; } }