// Kyoo - A portable and vast media library solution. // Copyright (c) Kyoo. // // See AUTHORS.md and LICENSE file in the project root for full license information. // // Kyoo is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. // // Kyoo is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Kyoo. If not, see . using System; using System.Text.Json.Serialization; using Kyoo.Abstractions.Models.Attributes; namespace Kyoo.Abstractions.Models; /// /// Has the user started watching, is it planned? /// public enum WatchStatus { /// /// The user has already watched this. /// Completed, /// /// The user started watching this but has not finished. /// Watching, /// /// The user does not plan to continue watching. /// Droped, /// /// The user has not started watching this but plans to. /// Planned, /// /// The watch status was deleted and can not be retrived again. /// Deleted, } /// /// Metadata of what an user as started/planned to watch. /// [SqlFirstColumn(nameof(UserId))] public class MovieWatchStatus : IAddedDate { /// /// The ID of the user that started watching this episode. /// public Guid UserId { get; set; } /// /// The user that started watching this episode. /// [JsonIgnore] public User User { get; set; } /// /// The ID of the movie started. /// public Guid MovieId { get; set; } /// /// The started. /// [JsonIgnore] public Movie Movie { get; set; } /// public DateTime AddedDate { get; set; } /// /// The date at which this item was played. /// public DateTime? PlayedDate { get; set; } /// /// Has the user started watching, is it planned? /// public WatchStatus Status { get; set; } /// /// Where the player has stopped watching the movie (in seconds). /// /// /// Null if the status is not Watching. /// public int? WatchedTime { get; set; } /// /// Where the player has stopped watching the movie (in percentage between 0 and 100). /// /// /// Null if the status is not Watching. /// public int? WatchedPercent { get; set; } } [SqlFirstColumn(nameof(UserId))] public class EpisodeWatchStatus : IAddedDate { /// /// The ID of the user that started watching this episode. /// public Guid UserId { get; set; } /// /// The user that started watching this episode. /// [JsonIgnore] public User User { get; set; } /// /// The ID of the episode started. /// public Guid? EpisodeId { get; set; } /// /// The started. /// [JsonIgnore] public Episode Episode { get; set; } /// public DateTime AddedDate { get; set; } /// /// The date at which this item was played. /// public DateTime? PlayedDate { get; set; } /// /// Has the user started watching, is it planned? /// public WatchStatus Status { get; set; } /// /// Where the player has stopped watching the episode (in seconds). /// /// /// Null if the status is not Watching. /// public int? WatchedTime { get; set; } /// /// Where the player has stopped watching the episode (in percentage between 0 and 100). /// /// /// Null if the status is not Watching or if the next episode is not started. /// public int? WatchedPercent { get; set; } } [SqlFirstColumn(nameof(UserId))] public class ShowWatchStatus : IAddedDate { /// /// The ID of the user that started watching this episode. /// public Guid UserId { get; set; } /// /// The user that started watching this episode. /// [JsonIgnore] public User User { get; set; } /// /// The ID of the show started. /// public Guid ShowId { get; set; } /// /// The started. /// [JsonIgnore] public Show Show { get; set; } /// public DateTime AddedDate { get; set; } /// /// The date at which this item was played. /// public DateTime? PlayedDate { get; set; } /// /// Has the user started watching, is it planned? /// public WatchStatus Status { get; set; } /// /// The number of episodes the user has not seen. /// public int UnseenEpisodesCount { get; set; } /// /// The ID of the episode started. /// public Guid? NextEpisodeId { get; set; } /// /// The next to watch. /// public Episode? NextEpisode { get; set; } /// /// Where the player has stopped watching the episode (in seconds). /// /// /// Null if the status is not Watching or if the next episode is not started. /// public int? WatchedTime { get; set; } /// /// Where the player has stopped watching the episode (in percentage between 0 and 100). /// /// /// Null if the status is not Watching or if the next episode is not started. /// public int? WatchedPercent { get; set; } } public class WatchStatus : IAddedDate { /// /// Has the user started watching, is it planned? /// public required WatchStatus Status { get; set; } /// public DateTime AddedDate { get; set; } /// /// The date at which this item was played. /// public DateTime? PlayedDate { get; set; } /// /// Where the player has stopped watching the episode (in seconds). /// /// /// Null if the status is not Watching or if the next episode is not started. /// public int? WatchedTime { get; set; } /// /// Where the player has stopped watching the episode (in percentage between 0 and 100). /// /// /// Null if the status is not Watching or if the next episode is not started. /// public int? WatchedPercent { get; set; } /// /// The user that started watching this episode. /// public required User User { get; set; } /// /// The episode/show/movie whose status changed /// public required T Resource { get; set; } }