DD.WellWorkover.Cloud/AsbCloudApp/Requests/TelemetryPartDeleteRequest.cs
2024-07-24 15:23:25 +05:00

40 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Requests;
/// <summary>
/// Параметры запроса на удаление куска телеметрии
/// </summary>
public class TelemetryPartDeleteRequest : IValidatableObject
{
/// <summary>
/// ключ телеметрии
/// </summary>
public int IdTelemetry { get; set; }
/// <summary>
/// greater or equal then Date. Must be set one of GeDate or LeDate
/// </summary>
public DateTimeOffset? GeDate { get; set; }
/// <summary>
/// less or equal then Date. Must be set one of GeDate or LeDate
/// </summary>
public DateTimeOffset? LeDate { get; set; }
/// <summary>
/// Валидация входящих данных
/// </summary>
/// <param name="validationContext"></param>
/// <returns></returns>
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (IdTelemetry == 0)
yield return new ValidationResult($"IdTelemetry must be defined");
if (!GeDate.HasValue && !LeDate.HasValue)
yield return new ValidationResult($"GeDate or LeDate must be defined");
}
}