using System.Collections.Generic; using System.ComponentModel; namespace API.DTOs.ReadingLists.CBL; public enum CblImportResult { /// /// There was an issue which prevented processing /// [Description("Fail")] Fail = 0, /// /// Some items were added, but not all /// [Description("Partial")] Partial = 1, /// /// Everything was imported correctly /// [Description("Success")] Success = 2 } public enum CblImportReason { /// /// The Chapter is not present in Kavita /// [Description("Chapter missing")] ChapterMissing = 0, /// /// The Volume is not present in Kavita or no Volume field present in CBL and there is no chapter matching /// [Description("Volume missing")] VolumeMissing = 1, /// /// The Series is not present in Kavita or the user does not have access to the Series due to some account restrictions /// [Description("Series missing")] SeriesMissing = 2, /// /// The CBL Name conflicts with another Reading List in the system /// [Description("Name Conflict")] NameConflict = 3, /// /// Every Series in the Reading list is missing from within Kavita or user has access restrictions to /// [Description("All Series Missing")] AllSeriesMissing = 4, /// /// There are no Book entries in the CBL /// [Description("Empty File")] EmptyFile = 5, /// /// Series Collides between Libraries /// [Description("Series Collision")] SeriesCollision = 6, /// /// Every book chapter is missing or can't be matched /// [Description("All Chapters Missing")] AllChapterMissing = 7, /// /// The Chapter was imported /// [Description("Success")] Success = 8, /// /// The file does not match the XML spec /// [Description("Invalid File")] InvalidFile = 9, } public class CblBookResult { /// /// Order in the CBL /// public int Order { get; set; } public string Series { get; set; } public string Volume { get; set; } public string Number { get; set; } /// /// Used on Series conflict /// public int LibraryId { get; set; } /// /// Used on Series conflict /// public int SeriesId { get; set; } /// /// The name of the reading list /// public string ReadingListName { get; set; } public CblImportReason Reason { get; set; } public CblBookResult(CblBook book) { Series = book.Series; Volume = book.Volume; Number = book.Number; } public CblBookResult() { } } /// /// Represents the summary from the Import of a given CBL /// public class CblImportSummaryDto { public string CblName { get; set; } /// /// Used only for Kavita's UI, the filename of the cbl /// public string FileName { get; set; } public ICollection Results { get; set; } public CblImportResult Success { get; set; } public ICollection SuccessfulInserts { get; set; } }