using System;
namespace Emby.Naming.AudioBook
{
    /// 
    /// Represents a single video file.
    /// 
    public class AudioBookFileInfo : IComparable
    {
        /// 
        /// Initializes a new instance of the  class.
        /// 
        /// Path to audiobook file.
        /// File type.
        /// Number of part this file represents.
        /// Number of chapter this file represents.
        public AudioBookFileInfo(string path, string container, int? partNumber = default, int? chapterNumber = default)
        {
            Path = path;
            Container = container;
            PartNumber = partNumber;
            ChapterNumber = chapterNumber;
        }
        /// 
        /// Gets or sets the path.
        /// 
        /// The path.
        public string Path { get; set; }
        /// 
        /// Gets or sets the container.
        /// 
        /// The container.
        public string Container { get; set; }
        /// 
        /// Gets or sets the part number.
        /// 
        /// The part number.
        public int? PartNumber { get; set; }
        /// 
        /// Gets or sets the chapter number.
        /// 
        /// The chapter number.
        public int? ChapterNumber { get; set; }
        /// 
        public int CompareTo(AudioBookFileInfo? other)
        {
            if (ReferenceEquals(this, other))
            {
                return 0;
            }
            if (ReferenceEquals(null, other))
            {
                return 1;
            }
            var chapterNumberComparison = Nullable.Compare(ChapterNumber, other.ChapterNumber);
            if (chapterNumberComparison != 0)
            {
                return chapterNumberComparison;
            }
            var partNumberComparison = Nullable.Compare(PartNumber, other.PartNumber);
            if (partNumberComparison != 0)
            {
                return partNumberComparison;
            }
            return string.Compare(Path, other.Path, StringComparison.Ordinal);
        }
    }
}