using API.Entities.Enums;
using API.Services;
namespace API.DTOs.Settings;
public class ServerSettingDto
{
public string CacheDirectory { get; set; } = default!;
public string TaskScan { get; set; } = default!;
///
/// Logging level for server. Managed in appsettings.json.
///
public string LoggingLevel { get; set; } = default!;
public string TaskBackup { get; set; } = default!;
///
/// Port the server listens on. Managed in appsettings.json.
///
public int Port { get; set; }
///
/// Comma separated list of ip addresses the server listens on. Managed in appsettings.json
///
public string IpAddresses { get; set; }
///
/// Allows anonymous information to be collected and sent to KavitaStats
///
public bool AllowStatCollection { get; set; }
///
/// Enables OPDS connections to be made to the server.
///
public bool EnableOpds { get; set; }
///
/// Base Url for the kavita. Requires restart to take effect.
///
public string BaseUrl { get; set; } = default!;
///
/// Where Bookmarks are stored.
///
/// If null or empty string, will default back to default install setting aka
public string BookmarksDirectory { get; set; } = default!;
public string InstallVersion { get; set; } = default!;
///
/// Represents a unique Id to this Kavita installation. Only used in Stats to identify unique installs.
///
public string InstallId { get; set; } = default!;
///
/// The format that should be used when saving media for Kavita
///
/// This includes things like: Covers, Bookmarks, Favicons
public EncodeFormat EncodeMediaAs { get; set; }
///
/// The amount of Backups before cleanup
///
/// Value should be between 1 and 30
public int TotalBackups { get; set; } = 30;
///
/// If Kavita should watch the library folders and process changes
///
public bool EnableFolderWatching { get; set; } = true;
///
/// Total number of days worth of logs to keep at a given time.
///
/// Value should be between 1 and 30
public int TotalLogs { get; set; }
///
/// The Host name (ie Reverse proxy domain name) for the server
///
public string HostName { get; set; }
///
/// The size in MB for Caching API data
///
public long CacheSize { get; set; }
///
/// How many Days since today in the past for reading progress, should content be considered for On Deck, before it gets removed automatically
///
public int OnDeckProgressDays { get; set; }
///
/// How many Days since today in the past for chapter updates, should content be considered for On Deck, before it gets removed automatically
///
public int OnDeckUpdateDays { get; set; }
///
/// How large the cover images should be
///
public CoverImageSize CoverImageSize { get; set; }
///
/// SMTP Configuration
///
public SmtpConfigDto SmtpConfig { get; set; }
///
/// Are at least some basics filled in
///
///
public bool IsEmailSetup()
{
//return false;
return !string.IsNullOrEmpty(SmtpConfig.Host)
&& !string.IsNullOrEmpty(SmtpConfig.UserName)
&& !string.IsNullOrEmpty(HostName);
}
}