using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using LCU.Library.Internal.ApiResponse.Models; using LCU.Library.Internal.DocumentIngestorModels.Enums; using LCU.Library.Internal.FileOperationsModels.Models.NameSettings; namespace LCU.Library.Internal.DocumentIngestorModels.Models { public class PdfPartitionerRequest : ReturnResponse { [Required(ErrorMessage = "Pdf Parser Types is required")] public PdfParserTypes PdfParserType { get; set; } [Required(ErrorMessage = "Root Base Path is required")] public string RootBasePath { get; set; } public int DaysIngestionDate { get; set; } public DateTime? IngestionDate { get; set; } public DynamicIngestionDate DynamicIngestionDate { get; set; } = new(); public bool UseDynamicIngestionDate { get; set; } = false; public string ParentDynamicDirectory { get; set; } = ""; public string SubDirectoryPath { get; set; } = ""; [Required(ErrorMessage = "Dynamic Index File Name is required")] public string DynamicIndexFileName { get; set; } public string DynamicPdfName { get; set; } public bool SkipParseIfCountsMatch { get; set; } public DynamicNameSetting ParentDynamicDirectorySettings { get; set; } public DynamicNameSetting DynamicFileSettings { get; set; } public DynamicNameSetting DynamicPdfSettings { get; set; } [NotMapped] public DateTime FinalIngestionDate { get { if (UseDynamicIngestionDate) { return new DateTime(DynamicIngestionDate.Year ?? DateTime.Now.Year, DynamicIngestionDate.Month ?? DateTime.Now.Month, DynamicIngestionDate.Day ?? DateTime.Now.Day); } return (IngestionDate ?? DateTime.Now).AddDays(DaysIngestionDate); } } [NotMapped] public string FinalRootBasePath { get { var rootBasePath = RootBasePath.EndsWith("\\") ? RootBasePath : $"{RootBasePath}\\"; return $"{rootBasePath}{FinalIngestionDate.ToString("MMddyyyy")}\\"; } } } }