Files
parr_api/PARR.DAL/Models/Template.cs

101 lines
3.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Microsoft.EntityFrameworkCore;
using PARR.Common.Domain;
using PARR.Constants;
using PARR.DAL.Models.Base;
using PARR.DAL.Models.Base.History;
using PARR.DAL.Models.Base.History.Base;
using PARR.DAL.Models.Job;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Templates")]
[Index(nameof(Name), nameof(Index), IsUnique = true)]
public class Template : IBase, ITemplateGeneralProps, IHistoryInitiator, IMyHistory<TemplateHistory>
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
/// <summary>
/// Индекс, используется в групповых шаблонах
/// </summary>
public int? Index { get; set; }
public bool IsActiveTemplate { get; set; }
public bool IsActiveSchedule { get; set; }
/// <summary>
/// Шаблон не используется : перестал подходить условиям Job'а
/// </summary>
public bool IsUnused { get; set; } = false;
/// <summary>
/// Номер расписания еспп
/// </summary>
public string? ScheduleEsppId { get; set; }
///// <summary>
///// Следующая дата срабатываения генерации наряда
///// </summary>
//public DateTimeOffset NextScheduleStart { get; set; }
///// <summary>
///// Следующа дата выполнения скрипта агентом. Может быть нулл если шаблон не автоматический (не выполняется скриптом)
///// </summary>
//public DateTimeOffset? NextScriptStart { get; set; }
public DateTimeOffset? LastRun { get; set; }
public DateTimeOffset NextRun { get; set; }
//public Guid ApplicationInWorkId { get; set; }
public Guid JobId { get; set; }//TODO Вернуть не NULL!!!
public Guid UnitId { get; set; }//TODO Вернуть не NULL!!!
//public Guid HostId { get; set; }
#region Initiator
public string? InitiatorIp { get; set; }
public ParrComponentsEnum? InitiatorParrComponentId { get; set; }
public string? InitiatorComment { get; set; }
#endregion
//[ForeignKey(nameof(ApplicationInWorkId))]
//public ApplicationsInWork? ApplicationsInWork { get; set; }
//[ForeignKey(nameof(HostId))]
//public Host? Host { get; set; }
[ForeignKey(nameof(JobId))]
public Job.Job? Job { get; set; }
[ForeignKey(nameof(UnitId))]
public Unit.Unit? Unit { get; set; }
public ICollection<RobotConfiguration> RobotConfigurations { get; set; } = new HashSet<RobotConfiguration>();
public ICollection<AgentHistory> AgentHistories { get; set; } = new HashSet<AgentHistory>();
public ICollection<Order> Orders { get; set; } = new HashSet<Order>();
public ICollection<TemplateHistory> TemplateHistories { get; set; } = new HashSet<TemplateHistory>();
public ICollection<UnitsInTemplate> UnitsInTemplate { get; set; } = new HashSet<UnitsInTemplate>();
}
}