2024-04-27 22:36:16 +02:00
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2024-07-30 16:19:51 +02:00
|
|
|
|
using System.Text.Json.Serialization;
|
2024-09-29 23:00:32 +02:00
|
|
|
|
using WatchIt.Common.Model.Rating;
|
|
|
|
|
|
using WatchIt.Common.Query;
|
2024-04-27 22:36:16 +02:00
|
|
|
|
using WatchIt.Database.Model.Media;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WatchIt.Common.Model.Movies;
|
|
|
|
|
|
|
2024-09-29 23:00:32 +02:00
|
|
|
|
public class MovieResponse : Movie, IQueryOrderable<MovieResponse>
|
2024-04-27 22:36:16 +02:00
|
|
|
|
{
|
|
|
|
|
|
#region PROPERTIES
|
|
|
|
|
|
|
2024-09-29 23:00:32 +02:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public static IDictionary<string, Func<MovieResponse, IComparable>> OrderableProperties { get; } = new Dictionary<string, Func<MovieResponse, IComparable>>
|
|
|
|
|
|
{
|
|
|
|
|
|
{ "id", x => x.Id },
|
|
|
|
|
|
{ "title", x => x.Title },
|
|
|
|
|
|
{ "original_title", x => x.OriginalTitle },
|
|
|
|
|
|
{ "description", x => x.Description },
|
|
|
|
|
|
{ "release_date", x => x.ReleaseDate },
|
|
|
|
|
|
{ "length", x => x.Length },
|
|
|
|
|
|
{ "budget", x => x.Budget },
|
|
|
|
|
|
{ "rating.average", x => x.Rating.Average },
|
|
|
|
|
|
{ "rating.count", x => x.Rating.Count }
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-30 16:19:51 +02:00
|
|
|
|
[JsonPropertyName("id")]
|
2024-04-27 22:36:16 +02:00
|
|
|
|
public long Id { get; set; }
|
2024-09-29 23:00:32 +02:00
|
|
|
|
|
|
|
|
|
|
[JsonPropertyName("rating")]
|
|
|
|
|
|
public RatingResponse Rating { get; set; }
|
2024-04-27 22:36:16 +02:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region CONSTRUCTORS
|
|
|
|
|
|
|
2024-07-30 16:19:51 +02:00
|
|
|
|
[JsonConstructor]
|
|
|
|
|
|
public MovieResponse() {}
|
|
|
|
|
|
|
2024-04-27 22:36:16 +02:00
|
|
|
|
[SetsRequiredMembers]
|
|
|
|
|
|
public MovieResponse(MediaMovie mediaMovie)
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = mediaMovie.Media.Id;
|
|
|
|
|
|
Title = mediaMovie.Media.Title;
|
|
|
|
|
|
OriginalTitle = mediaMovie.Media.OriginalTitle;
|
|
|
|
|
|
Description = mediaMovie.Media.Description;
|
|
|
|
|
|
ReleaseDate = mediaMovie.Media.ReleaseDate;
|
|
|
|
|
|
Length = mediaMovie.Media.Length;
|
|
|
|
|
|
Budget = mediaMovie.Budget;
|
2024-09-29 23:00:32 +02:00
|
|
|
|
Rating = new RatingResponse(mediaMovie.Media.RatingMedia);
|
2024-04-27 22:36:16 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|