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