2023-07-04 16:17:28 +00:00
|
|
|
using System;
|
2020-09-04 02:50:56 +00:00
|
|
|
using NzbDrone.Core.ImportLists;
|
2018-11-23 07:03:32 +00:00
|
|
|
using NzbDrone.Core.Movies;
|
|
|
|
|
2020-09-04 02:50:56 +00:00
|
|
|
namespace Radarr.Api.V3.ImportLists
|
2018-11-23 07:03:32 +00:00
|
|
|
{
|
2021-02-04 21:14:52 +00:00
|
|
|
public class ImportListResource : ProviderResource<ImportListResource>
|
2018-11-23 07:03:32 +00:00
|
|
|
{
|
|
|
|
public bool Enabled { get; set; }
|
|
|
|
public bool EnableAuto { get; set; }
|
2022-03-08 02:03:00 +00:00
|
|
|
public MonitorTypes Monitor { get; set; }
|
2018-11-23 07:03:32 +00:00
|
|
|
public string RootFolderPath { get; set; }
|
|
|
|
public int QualityProfileId { get; set; }
|
2020-09-04 02:50:56 +00:00
|
|
|
public bool SearchOnAdd { get; set; }
|
2018-11-23 07:03:32 +00:00
|
|
|
public MovieStatusType MinimumAvailability { get; set; }
|
2020-09-04 02:50:56 +00:00
|
|
|
public ImportListType ListType { get; set; }
|
2019-11-02 19:43:45 +00:00
|
|
|
public int ListOrder { get; set; }
|
2023-07-04 16:17:28 +00:00
|
|
|
public TimeSpan MinRefreshInterval { get; set; }
|
2018-11-23 07:03:32 +00:00
|
|
|
}
|
|
|
|
|
2020-09-04 02:50:56 +00:00
|
|
|
public class ImportListResourceMapper : ProviderResourceMapper<ImportListResource, ImportListDefinition>
|
2018-11-23 07:03:32 +00:00
|
|
|
{
|
2020-09-04 02:50:56 +00:00
|
|
|
public override ImportListResource ToResource(ImportListDefinition definition)
|
2018-11-23 07:03:32 +00:00
|
|
|
{
|
|
|
|
if (definition == null)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
var resource = base.ToResource(definition);
|
|
|
|
|
|
|
|
resource.Enabled = definition.Enabled;
|
|
|
|
resource.EnableAuto = definition.EnableAuto;
|
2022-03-08 02:03:00 +00:00
|
|
|
resource.Monitor = definition.Monitor;
|
2020-09-04 02:50:56 +00:00
|
|
|
resource.SearchOnAdd = definition.SearchOnAdd;
|
2018-11-23 07:03:32 +00:00
|
|
|
resource.RootFolderPath = definition.RootFolderPath;
|
|
|
|
resource.QualityProfileId = definition.ProfileId;
|
2019-12-04 01:56:49 +00:00
|
|
|
resource.MinimumAvailability = definition.MinimumAvailability;
|
2019-11-02 19:43:45 +00:00
|
|
|
resource.ListType = definition.ListType;
|
|
|
|
resource.ListOrder = (int)definition.ListType;
|
2023-07-04 16:17:28 +00:00
|
|
|
resource.MinRefreshInterval = definition.MinRefreshInterval;
|
2018-11-23 07:03:32 +00:00
|
|
|
|
|
|
|
return resource;
|
|
|
|
}
|
|
|
|
|
2020-09-04 02:50:56 +00:00
|
|
|
public override ImportListDefinition ToModel(ImportListResource resource)
|
2018-11-23 07:03:32 +00:00
|
|
|
{
|
|
|
|
if (resource == null)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
var definition = base.ToModel(resource);
|
|
|
|
|
|
|
|
definition.Enabled = resource.Enabled;
|
|
|
|
definition.EnableAuto = resource.EnableAuto;
|
2022-03-08 02:03:00 +00:00
|
|
|
definition.Monitor = resource.Monitor;
|
2020-09-04 02:50:56 +00:00
|
|
|
definition.SearchOnAdd = resource.SearchOnAdd;
|
2018-11-23 07:03:32 +00:00
|
|
|
definition.RootFolderPath = resource.RootFolderPath;
|
|
|
|
definition.ProfileId = resource.QualityProfileId;
|
2019-12-04 01:56:49 +00:00
|
|
|
definition.MinimumAvailability = resource.MinimumAvailability;
|
2019-11-02 19:43:45 +00:00
|
|
|
definition.ListType = resource.ListType;
|
2023-07-04 16:17:28 +00:00
|
|
|
definition.MinRefreshInterval = resource.MinRefreshInterval;
|
2018-11-23 07:03:32 +00:00
|
|
|
|
|
|
|
return definition;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|