You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.9 KiB

2 years ago
using System.ComponentModel.DataAnnotations;
using Connected.Annotations;
using Connected.Data;
using Connected.ServiceModel;
namespace Connected.Logistics.Types.Serials;
2 years ago
/// <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!;
}