using System;
using System.Collections.Generic;
using API.Entities.Enums;
using API.Entities.Interfaces;
namespace API.Entities;
public class Library : IEntityDate
{
public int Id { get; set; }
public string Name { get; set; }
public string CoverImage { get; set; }
public LibraryType Type { get; set; }
///
/// If Folder Watching is enabled for this library
///
public bool FolderWatching { get; set; } = true;
///
/// Include Library series on Dashboard Streams
///
public bool IncludeInDashboard { get; set; } = true;
///
/// Include Library series on Recommended Streams
///
public bool IncludeInRecommended { get; set; } = true;
///
/// Include library series in Search
///
public bool IncludeInSearch { get; set; } = true;
///
/// Should this library create and manage collections from Metadata
///
public bool ManageCollections { get; set; } = true;
public DateTime Created { get; set; }
public DateTime LastModified { get; set; }
public DateTime CreatedUtc { get; set; }
public DateTime LastModifiedUtc { get; set; }
///
/// Last time Library was scanned
///
/// Time stored in UTC
public DateTime LastScanned { get; set; }
public ICollection Folders { get; set; }
public ICollection AppUsers { get; set; }
public ICollection Series { get; set; }
public void UpdateLastModified()
{
LastModified = DateTime.Now;
LastModifiedUtc = DateTime.UtcNow;
}
public void UpdateLastScanned(DateTime? time)
{
if (time == null)
{
LastScanned = DateTime.Now;
}
else
{
LastScanned = (DateTime) time;
}
}
}