using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using LCU.Library.Internal.ApiResponse.Models; namespace LCU.Library.Internal.DocumentIngestorModels.Models { public class IngestionFolderCleanUpRequest : ReturnResponse { public DateTime? IngestionEndedDate { get; set; } public int DaysFromIngestionEndedDate { get; set; } = 0; public DateTime? ArchiveDate { get; set; } public int DaysFromArchiveDate { get; set; } = 0; [Required] public string ArchiveRootPath { get; set; } [NotMapped] public DateTime FinalIngestionEndedDate => IngestionEndedDate ?? DateTime.Today.AddDays(1).AddTicks(-1); [NotMapped] public DateTime FinalArchiveDate => ArchiveDate ?? DateTime.Today.AddDays(1).AddTicks(-1); [NotMapped] public DateTime CleanUpIngestionFoldersUntilDate => FinalIngestionEndedDate.AddDays(DaysFromIngestionEndedDate).Date.AddDays(1).AddTicks(-1); [NotMapped] public string ArchiveFolderName => FinalArchiveDate.AddDays(DaysFromArchiveDate).ToString("yyyy-MM-dd"); [NotMapped] public string ArchiveRootPathAndFolder => (ArchiveRootPath.EndsWith("\\") ? ArchiveRootPath : $"{ArchiveRootPath}\\") + ArchiveFolderName; } }