using System;
namespace MediaBrowser.Controller.Providers
{
public class MetadataStatus
{
///
/// Gets or sets the item identifier.
///
/// The item identifier.
public Guid ItemId { get; set; }
///
/// Gets or sets the name of the item.
///
/// The name of the item.
public string ItemName { get; set; }
///
/// Gets or sets the type of the item.
///
/// The type of the item.
public string ItemType { get; set; }
///
/// Gets or sets the name of the series.
///
/// The name of the series.
public string SeriesName { get; set; }
///
/// Gets or sets the date last metadata refresh.
///
/// The date last metadata refresh.
public DateTime? DateLastMetadataRefresh { get; set; }
///
/// Gets or sets the date last images refresh.
///
/// The date last images refresh.
public DateTime? DateLastImagesRefresh { get; set; }
///
/// Gets or sets the last result.
///
/// The last result.
public ProviderRefreshStatus LastStatus { get; set; }
///
/// Gets or sets the last result error message.
///
/// The last result error message.
public string LastErrorMessage { get; set; }
public DateTime? ItemDateModified { get; set; }
public void AddStatus(ProviderRefreshStatus status, string errorMessage)
{
if (LastStatus != status)
{
IsDirty = true;
}
if (string.IsNullOrEmpty(LastErrorMessage))
{
LastErrorMessage = errorMessage;
}
if (LastStatus == ProviderRefreshStatus.Success)
{
LastStatus = status;
}
}
public MetadataStatus()
{
LastStatus = ProviderRefreshStatus.Success;
}
public bool IsDirty { get; private set; }
public void SetDateLastMetadataRefresh(DateTime date)
{
if (date != (DateLastMetadataRefresh ?? DateTime.MinValue))
{
IsDirty = true;
}
DateLastMetadataRefresh = date;
}
public void SetDateLastImagesRefresh(DateTime date)
{
if (date != (DateLastImagesRefresh ?? DateTime.MinValue))
{
IsDirty = true;
}
DateLastImagesRefresh = date;
}
}
}