using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Lagerbestand.Models; /// /// Tire position in a stack /// public enum TirePosition { FrontLeft = 0, FrontRight = 1, RearLeft = 2, RearRight = 3 } /// /// Tire condition rating /// public enum TireCondition { Excellent = 0, // Like new Good = 1, // Normal wear Fair = 2, // Noticeable wear but safe Poor = 3, // Should be replaced soon Critical = 4 // Unsafe, needs replacement } /// /// Represents an individual tire within a tire stack. /// Allows detailed tracking of each tire's condition. /// A TireStack always has exactly 4 TireItems. /// public class TireItem { [Key] public Guid Id { get; set; } = Guid.NewGuid(); /// /// The tire stack this item belongs to /// public Guid TireStackId { get; set; } [ForeignKey(nameof(TireStackId))] public TireStack? TireStack { get; set; } /// /// Position of this tire in the stack /// public TirePosition Position { get; set; } /// /// Individual tread depth for this tire in mm /// [Range(0, 10)] public decimal? TreadDepth { get; set; } /// /// Condition rating for this tire /// public TireCondition Condition { get; set; } = TireCondition.Good; /// /// Any damage or issues noted /// [MaxLength(500)] public string? DamageNotes { get; set; } /// /// Individual DOT code if different from stack /// [MaxLength(20)] public string? DotCode { get; set; } /// /// Photo filename for tire condition documentation /// [MaxLength(500)] public string? PhotoFileName { get; set; } public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime? UpdatedAt { get; set; } /// /// Position display text in German /// [NotMapped] public string PositionText => Position switch { TirePosition.FrontLeft => "Vorne Links", TirePosition.FrontRight => "Vorne Rechts", TirePosition.RearLeft => "Hinten Links", TirePosition.RearRight => "Hinten Rechts", _ => "Unbekannt" }; /// /// Condition display text in German /// [NotMapped] public string ConditionText => Condition switch { TireCondition.Excellent => "Sehr gut", TireCondition.Good => "Gut", TireCondition.Fair => "Ausreichend", TireCondition.Poor => "Mangelhaft", TireCondition.Critical => "Kritisch", _ => "Unbekannt" }; }