2024-07-22 12:43:26 +05:00
|
|
|
using System;
|
2024-07-23 17:26:23 +05:00
|
|
|
using System.Collections.Generic;
|
2024-07-22 12:43:26 +05:00
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
|
|
namespace AsbCloudApp.Requests;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Параметры запроса на удаление куска телеметрии
|
|
|
|
/// </summary>
|
2024-07-23 17:26:23 +05:00
|
|
|
public class TelemetryPartDeleteRequest : IValidatableObject
|
2024-07-22 12:43:26 +05:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// ключ телеметрии
|
|
|
|
/// </summary>
|
|
|
|
public int IdTelemetry { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// greater or equal then Date
|
|
|
|
/// </summary>
|
|
|
|
public DateTimeOffset? GeDate { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// less or equal then Date
|
|
|
|
/// </summary>
|
|
|
|
public DateTimeOffset? LeDate { get; set; }
|
2024-07-23 17:26:23 +05:00
|
|
|
|
|
|
|
/// <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");
|
|
|
|
}
|
2024-07-22 12:43:26 +05:00
|
|
|
}
|