using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Lagerbestand.Models; /// /// Represents a vehicle owned by a customer. /// A customer can have multiple vehicles, each with their own tire stacks. /// public class Vehicle { [Key] public Guid Id { get; set; } = Guid.NewGuid(); /// /// The customer who owns this vehicle /// public Guid CustomerId { get; set; } [ForeignKey(nameof(CustomerId))] public Customer? Customer { get; set; } /// /// Vehicle manufacturer (e.g., "BMW", "Mercedes", "VW") /// [Required] [MaxLength(100)] public string Make { get; set; } = string.Empty; /// /// Vehicle model (e.g., "3er", "C-Klasse", "Golf") /// [MaxLength(100)] public string? Model { get; set; } /// /// Tire size for this vehicle (e.g., "225/45 R17") /// [Required] [MaxLength(50)] public string TireSize { get; set; } = string.Empty; /// /// Additional notes about the vehicle /// [MaxLength(500)] public string? Notes { get; set; } /// /// Whether this is the customer's primary/default vehicle /// public bool IsPrimary { get; set; } /// /// Whether the vehicle is active (not deleted) /// public bool IsActive { get; set; } = true; public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime? UpdatedAt { get; set; } /// /// Navigation property for tire stacks stored for this vehicle /// public ICollection TireStacks { get; set; } = new List(); /// /// Display name combining make, model, and tire size /// [NotMapped] public string DisplayName { get { var name = Make; if (!string.IsNullOrEmpty(Model)) name += $" {Model}"; if (!string.IsNullOrEmpty(TireSize)) name += $" ({TireSize})"; return name; } } /// /// Short display showing just make (for compact views) /// [NotMapped] public string ShortName => !string.IsNullOrEmpty(Model) ? $"{Make} {Model}" : Make; }