2022-12-07 14:10:45 +01:00

59 lines
1.9 KiB
C#

using System.ComponentModel.DataAnnotations;
using Connected.Annotations;
using Connected.Data;
using Connected.ServiceModel;
namespace Logistics.Types.Serials;
/// <summary>
/// Arguments used when inserting a new serial number.
/// </summary>
public sealed class InsertSerialArgs : Dto
{
/// <inheritdoc cref="ISerial.Entity"/>
[Required, MaxLength(128)]
public string Entity { get; set; } = default!;
/// <inheritdoc cref="ISerial.EntityId"/>
[Required, MaxLength(128)]
public string EntityId { get; set; } = default!;
/// <inheritdoc cref="ISerial.Quantity"/>
[MinValue(0)]
public float Quantity { get; set; }
/// <inheritdoc cref="ISerial.Created"/>
/// <remarks>
/// If this property is null, the process will most likely
/// set the value of the current date (DateTime.UtcNow).
/// </remarks>
public DateTimeOffset? Created { get; set; }
/// <inheritdoc cref="ISerial.BestBefore"/>
public DateTimeOffset? BestBefore { get; set; }
/// <inheritdoc cref="ISerial.Status"/>
public Status Status { get; set; } = Status.Disabled;
/// <inheritdoc cref="ISerial.Value"/>
[Required, MaxLength(128)]
public string Value { get; set; } = default!;
}
/// <summary>
/// The arguments used when updating the existing serial entity.
/// </summary>
public sealed class UpdateSerialArgs : PrimaryKeyArgs<long>
{
/// <summary>
/// The new quantity. This is an absolute value, do not provide
/// delta values.
/// </summary>
[MinValue(0)]
public float Quantity { get; set; }
/// <inheritdoc cref="ISerial.BestBefore"/>
public DateTimeOffset? BestBefore { get; set; }
/// <inheritdoc cref="ISerial.Status"/>
public Status Status { get; set; } = Status.Disabled;
}
/// <summary>
/// The arguments used for selecting serial by its value.
/// </summary>
public sealed class SelectSerialArgs : Dto
{
/// <inheritdoc cref="ISerial.Value"/>
[Required, MaxLength(128)]
public string Value { get; set; } = default!;
}