2015-01-27 05:57:07 +00:00
|
|
|
|
using System.Collections.Generic;
|
2014-08-22 00:57:23 +00:00
|
|
|
|
using System.Linq;
|
2014-11-16 18:48:27 +00:00
|
|
|
|
using NzbDrone.Common.EnsureThat;
|
2014-08-22 00:57:23 +00:00
|
|
|
|
|
2018-03-14 20:41:36 +00:00
|
|
|
|
namespace NzbDrone.Core.MediaFiles.MovieImport
|
2014-08-22 00:57:23 +00:00
|
|
|
|
{
|
|
|
|
|
public class ImportResult
|
|
|
|
|
{
|
|
|
|
|
public ImportDecision ImportDecision { get; private set; }
|
2015-01-27 05:57:07 +00:00
|
|
|
|
public List<string> Errors { get; private set; }
|
2014-08-22 00:57:23 +00:00
|
|
|
|
|
|
|
|
|
public ImportResultType Result
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2014-12-19 00:26:42 +00:00
|
|
|
|
if (Errors.Any())
|
|
|
|
|
{
|
|
|
|
|
if (ImportDecision.Approved)
|
|
|
|
|
{
|
|
|
|
|
return ImportResultType.Skipped;
|
|
|
|
|
}
|
2014-08-22 00:57:23 +00:00
|
|
|
|
|
2014-12-19 00:26:42 +00:00
|
|
|
|
return ImportResultType.Rejected;
|
|
|
|
|
}
|
2014-08-22 00:57:23 +00:00
|
|
|
|
|
2014-12-19 00:26:42 +00:00
|
|
|
|
return ImportResultType.Imported;
|
2014-08-22 00:57:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-27 05:57:07 +00:00
|
|
|
|
public ImportResult(ImportDecision importDecision, params string[] errors)
|
2014-08-22 00:57:23 +00:00
|
|
|
|
{
|
2014-11-16 18:48:27 +00:00
|
|
|
|
Ensure.That(importDecision, () => importDecision).IsNotNull();
|
|
|
|
|
|
2014-08-22 00:57:23 +00:00
|
|
|
|
ImportDecision = importDecision;
|
|
|
|
|
Errors = errors.ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|