|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using Connected.Annotations;
|
|
|
|
|
using Connected.Data;
|
|
|
|
|
using Connected.Entities.Annotations;
|
|
|
|
|
using Connected.Entities.Consistency;
|
|
|
|
|
|
|
|
|
|
namespace Logistics.Types.Serials;
|
|
|
|
|
/// <inheritdoc cref="ISerial"/>
|
|
|
|
|
[Table(Schema = Domain.Code)]
|
|
|
|
|
internal sealed record Serial : ConsistentEntity<long>, ISerial
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The entity identifier which can be used in caching keys for example.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public const string EntityKey = $"{Domain.Code}.{nameof(Serial)}";
|
|
|
|
|
/// <inheritdoc cref="ISerial.Entity"/>
|
|
|
|
|
[Ordinal(0), MaxLength(128)]
|
|
|
|
|
public string Entity { get; init; } = default!;
|
|
|
|
|
/// <inheritdoc cref="ISerial.EntityId"/>
|
|
|
|
|
[Ordinal(1), MaxLength(128)]
|
|
|
|
|
public string EntityId { get; init; } = default!;
|
|
|
|
|
/// <inheritdoc cref="ISerial.Value"/>
|
|
|
|
|
[Ordinal(2), MaxLength(128), Index(Unique = true)]
|
|
|
|
|
public string Value { get; init; } = default!;
|
|
|
|
|
/// <inheritdoc cref="ISerial.Quantity"/>
|
|
|
|
|
[Ordinal(3)]
|
|
|
|
|
public float Quantity { get; init; }
|
|
|
|
|
/// <inheritdoc cref="ISerial.Created"/>
|
|
|
|
|
[Ordinal(4)]
|
|
|
|
|
public DateTimeOffset Created { get; init; }
|
|
|
|
|
/// <inheritdoc cref="ISerial.BestBefore"/>
|
|
|
|
|
[Ordinal(5)]
|
|
|
|
|
public DateTimeOffset? BestBefore { get; init; }
|
|
|
|
|
/// <inheritdoc cref="ISerial.Status"/>
|
|
|
|
|
[Ordinal(6)]
|
|
|
|
|
public Status Status { get; init; } = Status.Disabled;
|
|
|
|
|
}
|