using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Text.Json.Serialization; using System.Threading.Tasks; using gehGassiApp.Domain.Base; using gehGassiApp.Domain.Common; namespace gehGassiApp.Domain.Dogs { /// /// Repräsentiert einen Hund /// public class Dog : SyncEntity { private DogSex _sex; private string _name; private string _description; private string _photo; private DateTimeOffset? _birthDate; private DogSize _size; private bool _pullsTheLeash; private bool _walksTheLeash; private bool _basicCommands; private bool _hunter; private bool _eating; private bool _jumper; private bool _likesAdults; private bool _likesChildren; private bool _likesConspecifics; private bool _isTrustful; private bool _isAggressiv; private bool _isLoneGunner; private DogAggressionLevel _aggressionLevel; private bool _rushesOutside; private bool _isCalm; private bool _isPeeing; private bool _isShy; private bool _isGuard; private string _intolerances; private bool _chiped; private bool _sterilized; private string _medicalInfo; private bool _houseTrained; private DogFeedingTimes _feedingTimes; private string _feedingIndividual; private RatingStatistics _ratingStatistics; private bool _blocked; private bool _locked; /// /// Id der Hunderasse /// [MaxLength(128)] public string DogRaceId { get; set; } /// /// Id des App-Users /// [Required] [MaxLength(128)] public string AppUserId { get; set; } #region Basis /// /// Nummer des Hundes /// [Required] [MaxLength(100)] public string Number { get; set; } /// /// Name des Hundes /// [Required] [MaxLength(100)] public string Name { get => _name; set { _name = value; OnPropertyChanged(); } } /// /// Optional: Beschreibung /// [MaxLength(5000)] public string Description { get => _description; set { _description = value; OnPropertyChanged(); } } /// /// Optional - Foto des Hundes /// [MaxLength(500)] public string Photo { get { if (string.IsNullOrWhiteSpace(_photo)) return string.Empty; if (!_photo.ToLower().StartsWith("http")) { if (!File.Exists(_photo)) return Path.Combine(FileSystem.AppDataDirectory, Path.GetFileName(_photo) ?? string.Empty); } return _photo; } set { _photo = value; OnPropertyChanged(); } } /// /// Geburtstag des Hundes /// public DateTimeOffset? BirthDate { get => _birthDate; set { _birthDate = value; OnPropertyChanged(); } } /// /// Geschlecht des Hundes /// [Required] public DogSex Sex { get => _sex; set { _sex = value; OnPropertyChanged(); } } /// /// Größe des Hundes /// [Required] public DogSize Size { get => _size; set { _size = value; OnPropertyChanged(); } } #endregion #region Eigenschaften beim Gassi gehen /// /// Zieht an der Leine /// [Required] public bool PullsTheLeash { get => _pullsTheLeash; set { _pullsTheLeash = value; OnPropertyChanged(); } } /// /// Geht an der Leine /// [Required] public bool WalksTheLeash { get => _walksTheLeash; set { _walksTheLeash = value; OnPropertyChanged(); } } /// /// Kennt die Grundkommandos /// [Required] public bool BasicCommands { get => _basicCommands; set { _basicCommands = value; OnPropertyChanged(); } } /// /// Jagd andere Tiere /// [Required] public bool Hunter { get => _hunter; set { _hunter = value; OnPropertyChanged(); } } /// /// Versucht alles zu essen /// [Required] public bool Eating { get => _eating; set { _eating = value; OnPropertyChanged(); } } /// /// Springt Menschen an /// [Required] public bool Jumper { get => _jumper; set { _jumper = value; OnPropertyChanged(); } } #endregion #region Persönlichkeit /// /// Mag Erwachsene /// [Required] public bool LikesAdults { get => _likesAdults; set { _likesAdults = value; OnPropertyChanged(); } } /// /// Mag Kinder /// [Required] public bool LikesChildren { get => _likesChildren; set { _likesChildren = value; OnPropertyChanged(); } } /// /// Mag Artgenossen /// [Required] public bool LikesConspecifics { get => _likesConspecifics; set { _likesConspecifics = value; OnPropertyChanged(); } } /// /// Ist zutraulich /// [Required] public bool IsTrustful { get => _isTrustful; set { _isTrustful = value; OnPropertyChanged(); } } /// /// Ist aggressiv /// [Required] public bool IsAggressiv { get => _isAggressiv; set { _isAggressiv = value; OnPropertyChanged(); } } /// /// Ist ein Einzelgänger /// [Required] public bool IsLoneGunner { get => _isLoneGunner; set { _isLoneGunner = value; OnPropertyChanged(); } } /// /// Aggressionsgrad des Hundes, wenn aggressiv /// [Required] public DogAggressionLevel AggressionLevel { get => _aggressionLevel; set { _aggressionLevel = value; OnPropertyChanged(); } } #endregion #region Verhalten wenn jemand das Haus betritt /// /// Stürmt nach draussen /// [Required] public bool RushesOutside { get => _rushesOutside; set { _rushesOutside = value; OnPropertyChanged(); } } /// /// Ist ruhig und entspannt /// [Required] public bool IsCalm { get => _isCalm; set { _isCalm = value; OnPropertyChanged(); } } /// /// Pinkelt vor Aufregung /// [Required] public bool IsPeeing { get => _isPeeing; set { _isPeeing = value; OnPropertyChanged(); } } /// /// Ist schüchtern /// [Required] public bool IsShy { get => _isShy; set { _isShy = value; OnPropertyChanged(); } } /// /// Bewacht das zuhause /// [Required] public bool IsGuard { get => _isGuard; set { _isGuard = value; OnPropertyChanged(); } } #endregion #region Medical /// /// Unverträglichkeiten /// [MaxLength(5000)] public string Intolerances { get => _intolerances; set { _intolerances = value; OnPropertyChanged(); } } /// /// Ist gechipt /// [Required] public bool Chiped { get => _chiped; set { _chiped = value; OnPropertyChanged(); } } /// /// Ist sterilisiert? /// [Required] public bool Sterilized { get => _sterilized; set { _sterilized = value; OnPropertyChanged(); } } /// /// Medizinische Informationen /// [MaxLength(5000)] public string MedicalInfo { get => _medicalInfo; set { _medicalInfo = value; OnPropertyChanged(); } } #endregion #region Sitting /// /// Ist stubenrein? /// [Required] public bool HouseTrained { get => _houseTrained; set { _houseTrained = value; OnPropertyChanged(); } } /// /// Fütterungszeiten /// [Required] public DogFeedingTimes FeedingTimes { get => _feedingTimes; set { _feedingTimes = value; OnPropertyChanged(); } } /// /// Fütterungszeiten Individuell /// [MaxLength(500)] public string FeedingIndividual { get => _feedingIndividual; set { _feedingIndividual = value; OnPropertyChanged(); } } #endregion /// /// Rating-Statistiken für den Hund /// public RatingStatistics RatingStatistics { get => _ratingStatistics; set { _ratingStatistics = value; OnPropertyChanged(); } } #region Erweiterung Blockier- und Sperrinfo /// /// Hundebesitzer ist blockiert /// [NotMapped] public bool Blocked { get => _blocked; set { if (value == _blocked) return; _blocked = value; OnPropertyChanged(); OnPropertyChanged(nameof(BlockedOrLocked)); } } /// /// Hundebesitzer ist gesperrt /// [NotMapped] public bool Locked { get => _locked; set { if (value == _locked) return; _locked = value; OnPropertyChanged(); OnPropertyChanged(nameof(BlockedOrLocked)); } } /// /// Hundebesitzer blockiert oder gesperrt? /// [NotMapped] public bool BlockedOrLocked => Blocked || Locked; #endregion /// /// Datum der Erstellung /// public DateTimeOffset Created { get; set; } public Dog() { RatingStatistics = new RatingStatistics(); OnPropertyChanged(); } } /// /// Min-Info eines Hundes /// public class DogMinInfo : SyncEntityVw { /// /// Id der Hunderasse /// public string DogRaceId { get; set; } /// /// Name der Hunderasse /// public string DogRaceName { get; set; } /// /// Name des Hundes /// public string Name { get; set; } /// /// Optional - Foto des Hundes /// public string Photo { get; set; } /// /// Geschlecht /// public DogSex Sex { get; set; } /// /// Größe des Hundes /// public DogSize Size { get; set; } /// /// Geburtstag des Hundes /// public DateTimeOffset? BirthDate { get; set; } /// /// Durchschnittliche Bewertung /// public decimal AverageRating { get; set; } /// /// Anzahl Bewertungen /// public int TotalRatings { get; set; } #region Erweiterung Blockier- und Sperrinfo /// /// Hundebesitzer ist blockiert /// [NotMapped] public bool Blocked { get; set; } /// /// Hundebesitzer ist gesperrt /// [NotMapped] public bool Locked { get; set; } /// /// Hundebesitzer blockiert oder gesperrt? /// [NotMapped] public bool BlockedOrLocked => Blocked || Locked; #endregion } /// /// Hilfsklasse für das Speichern von Hunden zu Walks /// public class DogWalkJson { /// /// Id des Hundes /// [JsonPropertyName("id")] public string Id { get; set; } /// /// Name des Hundes /// [JsonPropertyName("name")] public string Name { get; set; } } }