41 lines
2.3 KiB
C#
41 lines
2.3 KiB
C#
using System.ComponentModel.DataAnnotations;
|
||
using System.ComponentModel.DataAnnotations.Schema;
|
||
using AyCode.Core.Serializers.Attributes;
|
||
using AyCode.Core.Serializers.Toons;
|
||
using AyCode.Core.Consts;
|
||
using FruitBank.Common.Interfaces;
|
||
using LinqToDB.Mapping;
|
||
using Mango.Nop.Core.Entities;
|
||
using Newtonsoft.Json;
|
||
|
||
namespace FruitBank.Common.Entities;
|
||
|
||
[AcBinarySerializable(false, true, false, true, false, false)]
|
||
[ToonDescription("Cargo vehicle — truck or trailer — owned by a transport partner", Purpose = "A single vehicle in a transport company's fleet. One table holds both tractor units and trailers, distinguished by IsTrailer. Truck and trailer are tracked as separate vehicles because Hungarian EKÁER road-freight reporting (NAV) declares the towing vehicle and the trailer as distinct entries (vehicle / vehicle2), each with its own licence plate and country code — i.e. these shipments carry an EKÁER declaration obligation.")]
|
||
[LinqToDB.Mapping.Table(Name = FruitBankConstClient.CargoTruckDbTableName)]
|
||
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.CargoTruckDbTableName)]
|
||
public sealed class CargoTruck: MgEntityBase, ICargoTruck
|
||
{
|
||
[ToonDescription(Purpose = "FK to the owning transport company (CargoPartner) — the carrier, not the goods supplier.")]
|
||
public int CargoPartnerId { get; set; }
|
||
|
||
[LinqToDB.Mapping.Association(ThisKey = nameof(CargoPartnerId), OtherKey = nameof(CargoPartner.Id), CanBeNull = true)]
|
||
public CargoPartner CargoPartner { get; set; }
|
||
|
||
[RegularExpression(AcRegExpression.CountryCodeMax3Mask, ErrorMessage = "A jármű országkódja 1–3 nagybetű (pl. HU).")]
|
||
public string CountryCode { get; set; }
|
||
|
||
[Required(ErrorMessage = "A rendszám kötelező.")]
|
||
[RegularExpression(AcRegExpression.PlateNumberMask, ErrorMessage = "A rendszám csak nagybetű és szám lehet, kötőjel/szóköz nélkül (pl. ABC123).")]
|
||
public string LicencePlate { get; set; }
|
||
|
||
[ToonDescription(Purpose = "Discriminates the shared table: false = tractor/truck unit, true = trailer.")]
|
||
public bool IsTrailer { get; set; }
|
||
|
||
[NotColumn, NotMapped, JsonIgnore, System.Text.Json.Serialization.JsonIgnore]
|
||
public string? CargoPartnerName => CargoPartner?.Name;
|
||
|
||
public DateTime Created { get; set; }
|
||
public DateTime Modified { get; set; }
|
||
}
|