using Microsoft.EntityFrameworkCore; using PARR.Domain.Entities.Base; using PARR.Domain.Entities.Base.History; using PARR.Domain.Entities.Base.History.Base; using PARR.Domain.Entities.JobEntities; using PARR.Domain.Enums; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace PARR.Domain.Entities { [Table("Templates")] [Index(nameof(Name), nameof(Index), IsUnique = true)] public class Template : IBaseEntity, ITemplateGeneralProps, IHistoryInitiator, IMyHistory { [Key] public Guid Id { get; set; } public DateTimeOffset DateCreated { get; set; } public DateTimeOffset? DateModified { get; set; } public required string Name { get; set; } /// /// Индекс, используется в групповых шаблонах /// public int? Index { get; set; } public bool IsActiveTemplate { get; set; } public bool IsActiveSchedule { get; set; } /// /// Номер расписания еспп /// public string? ScheduleEsppId { get; set; } ///// ///// Следующая дата срабатываения генерации наряда ///// //public DateTimeOffset NextScheduleStart { get; set; } ///// ///// Следующа дата выполнения скрипта агентом. Может быть нулл если шаблон не автоматический (не выполняется скриптом) ///// //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; } public Guid UnitId { get; set; } public TemplateStatusTypeEnum StatusTypeId { get; set; } = TemplateStatusTypeEnum.Used; //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 JobEntities.Job? Job { get; set; } [ForeignKey(nameof(UnitId))] public Unit.Unit? Unit { get; set; } public ICollection RobotConfigurations { get; set; } = new HashSet(); public ICollection AgentHistories { get; set; } = new HashSet(); public ICollection Orders { get; set; } = new HashSet(); public ICollection TemplateHistories { get; set; } = new HashSet(); public ICollection UnitsInTemplate { get; set; } = new HashSet(); public TemplateStatusType? StatusType { get; set; } } }