using Pilz.Networking.CloudProviders.Nextcloud.OCS.Data.Apps.FileRetention; using Pilz.Networking.CloudProviders.Nextcloud.OCS.Responses.Apps.FilesRetention; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Pilz.Networking.CloudProviders.Nextcloud.Model.Apps.FilesRetention { public class RetentionRule { /// /// The ID for the retention rule. /// public int ID { get; init; } /// /// The ID for the tag that is used for this rule. /// public int TagID { get; init; } /// /// The unit used for the time. /// public RetentionTimeUnit TimeUnit { get; init; } /// /// Represents numer of days/weeks/months/years. /// public int TimeAmount { get; init; } /// /// The time used for the rule. /// public RetentionTimeAfter TimeAfter { get; init; } /// /// Defines if a background job has been generated /// public bool HasJob { get; init; } public RetentionRule(int iD, int tagID, RetentionTimeUnit timeUnit, int timeAmount, RetentionTimeAfter timeAfter, bool hasJob) { ID = iD; TagID = tagID; TimeUnit = timeUnit; TimeAmount = timeAmount; TimeAfter = timeAfter; HasJob = hasJob; } public RetentionRule(OcsResponseDataEntryRetention data) { ID = data.ID ?? -1; TagID = data.TagID ?? -1; TimeUnit = (RetentionTimeUnit)(data.TimeUnit ?? 0); TimeAmount = data.TimeAmount ?? -1; TimeAfter = (RetentionTimeAfter)(data.TimeAfter ?? 0); } public OcsDataRetentionRule ToOcsData() { return new OcsDataRetentionRule { TagID = TagID, TimeUnit = (int)TimeUnit, TimeAmount = TimeAmount, TimeAfter = (int)TimeAfter }; } } }