using System.Globalization;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Library;

namespace Jellyfin.Plugin.SmartPlaylist {
    public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages {
        public IServerApplicationPaths ServerApplicationPaths;
        public IUserManager UserManager;
        public Plugin(
            IApplicationPaths applicationPaths,
            IXmlSerializer xmlSerializer,
            IServerApplicationPaths serverApplicationPaths,
            IUserManager userManager
        ) : base (applicationPaths, xmlSerializer) {
            Instance = this;
            ServerApplicationPaths = serverApplicationPaths;
            UserManager = userManager;
        }
        public static Plugin? Instance {get; private set; }
        public override string Name => "Smart Playlist";
        public override Guid Id => Guid.Parse("dd2326e3-4d3e-4bfc-80e6-28502c1131df");
        public IEnumerable<PluginPageInfo> GetPages() {
            return new[] {
                new PluginPageInfo {
                    Name = this.Name,
                    EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Configuration.configPage.html", GetType().Namespace),
                },
                new PluginPageInfo {
                    Name = "configPage.js",
                    EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Configuration.configPage.js", GetType().Namespace),
                },
                new PluginPageInfo {
                    Name = "Smart Playlists",
                    DisplayName = "Smart Playlists",
                    EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Pages.smartPlaylists.html", GetType().Namespace),
                    EnableInMainMenu = true,
                },
                new PluginPageInfo {
                    Name = "smartPlaylists.js",
                    EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Pages.smartPlaylists.js", GetType().Namespace),
                },
                new PluginPageInfo {
                    Name = "Smart Collections",
                    DisplayName = "Smart Collections",
                    EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Pages.smartCollections.html", GetType().Namespace),
                    EnableInMainMenu = true,
                },
                new PluginPageInfo {
                    Name = "smartCollections.js",
                    EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Pages.smartCollections.js", GetType().Namespace),
                },
                new PluginPageInfo {
                    Name = "Lisp Playground",
                    DisplayName = "Lisp Playground",
                    EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Pages.lispPlayground.html", GetType().Namespace),
                    EnableInMainMenu = true,
                },
                new PluginPageInfo {
                    Name = "lispPlayground.js",
                    EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Pages.lispPlayground.js", GetType().Namespace),
                },
            };
        }
    }
}