// <copyright file="AudioBook.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>

#nullable disable

#pragma warning disable CA1724, CS1591

using System;
using System.Text.Json.Serialization;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Providers;

namespace MediaBrowser.Controller.Entities
{
    [Common.RequiresSourceSerialisation]
    public class AudioBook : Audio.Audio, IHasSeries, IHasLookupInfo<SongInfo>
    {
        [JsonIgnore]
        public override bool SupportsPositionTicksResume => true;

        [JsonIgnore]
        public override bool SupportsPlayedStatus => true;

        [JsonIgnore]
        public string SeriesPresentationUniqueKey { get; set; }

        [JsonIgnore]
        public string SeriesName { get; set; }

        [JsonIgnore]
        public Guid SeriesId { get; set; }

        /// <summary>
        /// Finds the series sort name.
        /// </summary>
        /// <returns>The series sort name.</returns>
        public string FindSeriesSortName()
        {
            return this.SeriesName;
        }

        /// <summary>
        /// Finds the series name.
        /// </summary>
        /// <returns>The series name.</returns>
        public string FindSeriesName()
        {
            return this.SeriesName;
        }

        /// <summary>
        /// Finds the series presentation unique key.
        /// </summary>
        /// <returns>The series presentation unique key.</returns>
        public string FindSeriesPresentationUniqueKey()
        {
            return this.SeriesPresentationUniqueKey;
        }

        /// <summary>
        /// Gets the default primary image aspect ratio.
        /// </summary>
        /// <returns>The default primary image aspect ratio.</returns>
        public override double GetDefaultPrimaryImageAspectRatio()
        {
            return 0;
        }

        /// <summary>
        /// Finds the series identifier.
        /// </summary>
        /// <returns>The series identifier.</returns>
        public Guid FindSeriesId()
        {
            return this.SeriesId;
        }

        /// <summary>
        /// Determines whether this audiobook can be downloaded.
        /// </summary>
        /// <returns>True if downloadable; otherwise, false.</returns>
        public override bool CanDownload()
        {
            return this.IsFileProtocol;
        }

        /// <summary>
        /// Gets the unrated type for blocking purposes.
        /// </summary>
        /// <returns>The unrated item type.</returns>
        public override UnratedItem GetBlockUnratedType()
        {
            return UnratedItem.Book;
        }
    }
}
