using LCU.Library.Internal.ApiResponse.Models; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using LCU.Library.Internal.FileOperationsModels.Models.NameSettings; using LCU.Library.Internal.FileOperationsModels.Shared; using System.ComponentModel; namespace LCU.Api.Internal.FTPLib.Models { public class SftpDownloadFileRequest : ReturnResponse { [Required] public SessionInformation SessionInformation { get; set; } [Required] public string RemoteFilePath { get; set; } [Required] public string RemoteFileName { get; set; } [Required] public string LocalFilePath { get; set; } [DefaultValue(false)] public bool ShouldRemove { get; set; } [DefaultValue(false)] public bool SucceedOnEmpty { get; set; } public DynamicNameSetting DynamicNameSetting { get; set; } [DefaultValue(true)] public bool ResumeSupportStateOn { get; set; } = true; [NotMapped] public string FinalRemoteFileName { get { return DynamicNameBuilder.BuildDynamicName(RemoteFileName, DynamicNameSetting); } } public DynamicNameSetting DynamicRemotePathSetting { get; set; } public DynamicNameSetting DynamicLocalPathSetting { get; set; } [NotMapped] public string FinalRemoteFilePath { get { var remoteFilePath = RemoteFilePath.EndsWith("/") ? RemoteFilePath : $"{RemoteFilePath}/"; return DynamicNameBuilder.BuildDynamicName(remoteFilePath, DynamicRemotePathSetting); } } [NotMapped] public string FinalLocalFilePath { get { var localFilePath = LocalFilePath.EndsWith("\\") ? LocalFilePath : $"{LocalFilePath}\\"; return DynamicNameBuilder.BuildDynamicName(localFilePath, DynamicLocalPathSetting); } } } }