using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data
{
///
/// Описание данных графика работ
///
public class ScheduleDto : IId, IWellRelated, IValidatableObject
{
///
[Required]
public int Id { get; set; }
///
[Required]
public int IdWell { get; set; }
///
/// Идентификатор бурильщика
///
[Required]
public int IdDriller { get; set; }
///
/// Начало смены
///
[Required]
public TimeDto ShiftStart { get; set; } = null!;
///
/// Конец смены
///
[Required]
public TimeDto ShiftEnd { get; set; } = null!;
///
/// Начало бурения
///
[Required]
public DateTimeOffset DrillStart { get; set; }
///
/// Конец бурения
///
[Required]
public DateTimeOffset DrillEnd { get; set; }
///
/// Бурильщик
///
public DrillerDto? Driller { get; set; }
///
public IEnumerable Validate(ValidationContext validationContext)
{
if(DrillStart >= DrillEnd)
yield return new ValidationResult($"DrillStart > DrillEnd");
}
}
}