using System.Collections.Generic;

namespace MosswartMassacre
{
    /// <summary>
    /// Static quest name mappings from quest stamp to friendly display name
    /// Based on questtracker repository data
    /// </summary>
    public static class QuestNames
    {
        /// <summary>
        /// Dictionary mapping quest stamps to friendly quest names
        /// </summary>
        public static readonly Dictionary<string, string> QuestStampToName = new Dictionary<string, string>
        {
            // Character-specific Quest Stamps (from actual /myquests output)
            ["30minattributes"] = "30 Minute Attribute Gems Timer",
            ["academeyexittokengiven"] = "Academy Exit Token Received",
            ["aerbaxchestkey2pickup"] = "Aerbax Chest Key #2 Pickup",
            ["anekshaygemofknowledgetimer_monthly"] = "A'nekshay Gem of Knowledge Monthly Timer",
            ["anekshaygemoflesserknowledgecollectedinamonth"] = "A'nekshay Gems of Lesser Knowledge Monthly Count",
            ["anekshaygemoflesserknowledgetimer_monthly"] = "A'nekshay Gem of Lesser Knowledge Monthly Timer",
            ["attributereset30day"] = "30-Day Attribute Reset Timer",
            ["augmentationblankgemacquired"] = "Blank Augmentation Gem Pickup Timer",
            ["bellowsnewbieturnedin"] = "Blacksmith's Bellows Turned In",
            ["bonecrunchkeypickuptimer"] = "Bonecrunch's Key Pickup Timer",
            ["callingstonegiven"] = "Calling Stone Turned Over",
            ["defeatedbonecrunch"] = "Bonecrunch Defeated",
            ["efmlcentermanafieldused"] = "EF Middle Level Center Mana Field Used",
            ["efmleastmanafieldused"] = "EF Middle Level East Mana Field Used",
            ["efmlnorthmanafieldused"] = "EF Middle Level North Mana Field Used",
            ["efmlsouthmanafieldused"] = "EF Middle Level South Mana Field Used",
            ["efmlwestmanafieldused"] = "EF Middle Level West Mana Field Used",
            ["efulcentermanafieldused"] = "EF Upper Level Center Mana Field Used",
            ["efuleastmanafieldused"] = "EF Upper Level East Mana Field Used",
            ["efulnorthmanafieldused"] = "EF Upper Level North Mana Field Used",
            ["efulsouthmanafieldused"] = "EF Upper Level South Mana Field Used",
            ["efulwestmanafieldused"] = "EF Upper Level West Mana Field Used",
            ["insatiableeaterjaw"] = "Insatiable Eater Jaw Collection",
            ["pathwardencomplete"] = "Pathwarden Visit Complete",
            ["pathwardenfound1111"] = "Pathwarden Greeter Encountered",
            ["recallsingularitycaul"] = "Recall Singularity Bore Pickup",
            ["stipendscollectedinamonth"] = "Monthly Stipends Collected Count",
            ["stipendtimer_0812"] = "Stipend Collection Timer",
            ["stipendtimer_monthly"] = "Monthly Stipend Timer",
            ["upperinsatiablejaw"] = "Upper Insatiable Eater Jaw Collection",
            ["usedattributereset"] = "Attribute Reset Used",
            ["usedfreeattributereset"] = "Free Attribute Reset Used",
            ["usedfreeskillreset"] = "Free Skill Reset Used",
            ["usedskillreset"] = "Skill Reset Used",
            ["virindiisland"] = "Singularity Island Visit",
            
            // Kill Tasks
            ["turshscalp"] = "Tursh Scalp",
            ["polarursuin"] = "Polar Ursuin Kill Task Main Flag Timer",
            ["polarursuinkillcount"] = "Polar Ursuin Kill Counter",
            ["polardillotask"] = "Polar Dillo Kill Task Main Flag",
            ["polardillokills"] = "Polar Dillo Kill Counter",
            ["repugnanteaterkilltask"] = "Repugnant Eater Kill Task",
            ["repugeaterkillcount"] = "Repugnant Eater Kill Counter",
            ["deathcap"] = "Deathcap Thrungus Kill Task",
            ["deathcapkillcount"] = "Deathcap Thrungus Kill Counter",
            ["grievverv"] = "Grievver Violator Kill Task",
            ["grievvervkillcount"] = "Grievver Violator Kill Counter",
            ["tuskerg"] = "Tusker Guard Kill Task Main Flag",
            ["tuskergkillcount"] = "Tusker Guard Kill Counter",
            
            // Quest Timers and Pickups
            ["blankaug"] = "Blank Aug Gem Pickup Timer",
            ["greatcavepenguinegg"] = "Great Cave Penguin Egg Pickup Timer",
            ["deathallurecd"] = "Death's Allure Timer Flag",
            ["brewmastercover"] = "Brew Master Quest Pickup Timer Cover",
            ["brewmasterback"] = "Brew Master Quest Pickup Timer Back",
            ["brewmasterpages"] = "Brew Master Quest Pickup Timer Pages",
            ["brewmasterspine"] = "Brew Master Quest Pickup Timer Spine",
            ["eleonorasheart"] = "Elanora's Heart Quest Pickup Timer",
            ["beacongemobtained"] = "Cooldown for obtaining another beacon gem",
            ["beaconcomplete"] = "Beacon Quest Complete Timer",
            ["sirginaziosword"] = "Pick up of Sir Ginazio's Sword",
            
            // Major Quests
            ["maraudersjaw"] = "Marauder's Lair Quest",
            ["fledgemastertusk"] = "Fledge Master's Tusk Quest",
            ["crystallinekiller"] = "Crystalline Killer",
            ["darkisledelivery"] = "Dark Isle Delivery",
            ["defeatingvaeshok"] = "Defeating Vaeshok",
            ["hollyjollyhelperquest"] = "Holly Jolly Helper Quest",
            ["moarsmenjailbreak"] = "Moarsmen Jailbreak",
            ["shamblingarchivistdestroyer"] = "Shambling Archivist Destroyer",
            ["tracingthestone"] = "Tracing The Stone",
            ["undeadjawcollection"] = "Undead Jaw Collection",
            ["weedingofthederutree"] = "Weeding of the Deru Tree",
            ["ironbladecommander"] = "Iron Blade Commander",
            ["mumiyahhuntingneftet"] = "Mumiyah Hunting Neftet",
            ["torgashstasks"] = "Torgash's Tasks",
            
            // Thrungus Hovels Items
            ["stolenfryingpan"] = "Thrungus Hovels",
            ["stolenring"] = "Thrungus Hovels",
            ["stolenbrewkettle"] = "Thrungus Hovels",
            ["stolenamulet"] = "Thrungus Hovels",
            ["stolenewer"] = "Thrungus Hovels",
            ["stolennecklace"] = "Thrungus Hovels",
            ["stolenplatter"] = "Thrungus Hovels",
            ["stolenbracelet"] = "Thrungus Hovels",
            
            // Special Items and Flags
            ["ringofkarlun"] = "Knights of Karlun",
            ["trainingacademycomplete"] = "Completion of Training Academy for Exit",
            ["cowtipcounter"] = "Counter for Cow Tipping",
            ["cowtip"] = "Main Timed Flag for Cow Tipping",
            ["skillloweringgempickedup"] = "Picked up a forgetfulness gem",
            
            // Healing Machine Components
            ["orbhealingmachine"] = "Healing Machine Orb",
            ["pedestalhealingmachine"] = "Healing Machine Pedestal",
            ["tihnhealingmachine"] = "Healing Machine Tihn",
            ["lavushealingmachine"] = "Healing Machine Lavus",
            ["hookhealingmachine"] = "Healing Machine Hook",
            
            // Eater Jaws
            ["ravenouseaterjaw"] = "Ravenous Eater Jaw",
            ["insatiableeaterjaw"] = "Insatiable Eater Jaw",
            ["engorgedeaterjaw"] = "Engorged Eater Jaw",
            ["voraciouseaterjaw"] = "Voracious Eater Jaw",
            ["abhorrenteaterjaw"] = "Abhorrent Eater Jaw",
            
            // Kill Tasks (Extended)
            ["altereddrudgekilltask"] = "Altered Drudge Kill Task",
            ["altereddrudgekillcount"] = "Altered Drudge Kill Counter",
            ["arcticmattekarkilltask"] = "Arctic Mattekar Kill Task",
            ["arcticmattekarkillcount"] = "Arctic Mattekar Kill Counter",
            ["armoredillohuntingneftetkilltask"] = "Armoredillo Hunting Neftet Kill Task",
            ["armoredillohuntingneftetkillcount"] = "Armoredillo Hunting Neftet Kill Counter",
            ["augmenteddrudgekilltask"] = "Augmented Drudge Kill Task",
            ["augmenteddrudgekillcount"] = "Augmented Drudge Kill Counter",
            ["banishedcreaturekilltask"] = "Banished Creature Kill Task",
            ["banishedcreaturekillcount"] = "Banished Creature Kill Counter",
            ["benekniffiskilltask"] = "Benek Niffis Kill Task",
            ["benekniffiskillcount"] = "Benek Niffis Kill Counter",
            ["blackcoralgolemkilltask"] = "Black Coral Golem Kill Task",
            ["blackcoralgolemkillcount"] = "Black Coral Golem Kill Counter",
            ["blessedmoarsmankilltask"] = "Blessed Moarsman Kill Task",
            ["blessedmoarsmankillcount"] = "Blessed Moarsman Kill Counter",
            ["blightedcoralgolemkilltask"] = "Blighted Coral Golem Kill Task",
            ["blightedcoralgolemkillcount"] = "Blighted Coral Golem Kill Counter",
            ["bloodshrethkilltask"] = "Blood Shreth Kill Task",
            ["bloodshrethkillcount"] = "Blood Shreth Kill Counter",
            ["bronzegauntlettrooperkilltask"] = "Bronze Gauntlet Trooper Kill Task",
            ["bronzegauntlettrooperkillcount"] = "Bronze Gauntlet Trooper Kill Counter",
            ["coppercogtrooperkilltask"] = "Copper Cog Trooper Kill Task",
            ["coppercogtrooperkillcount"] = "Copper Cog Trooper Kill Counter",
            ["coppergolemkingpinkilltask"] = "Copper Golem Kingpin Kill Task",
            ["coppergolemkingpinkillcount"] = "Copper Golem Kingpin Kill Counter",
            ["coralgolemkilltask"] = "Coral Golem Kill Task",
            ["coralgolemkillcount"] = "Coral Golem Kill Counter",
            ["coralgolemviceroykilltask"] = "Coral Golem Viceroy Kill Task",
            ["coralgolemviceroykillcount"] = "Coral Golem Viceroy Kill Counter",
            ["corruptedgravestonekilltask"] = "Corrupted Gravestone Kill Task",
            ["corruptedgravestonekillcount"] = "Corrupted Gravestone Kill Counter",
            ["deathcapthrunguskilltask"] = "Deathcap Thrungus Kill Task",
            ["deathcapthrunguskillcount"] = "Deathcap Thrungus Kill Counter",
            ["desertcactuskilltask"] = "Desert Cactus Kill Task",
            ["desertcactuskillcount"] = "Desert Cactus Kill Counter",
            ["devourermargulkilltask"] = "Devourer Margul Kill Task",
            ["devourermargulkillcount"] = "Devourer Margul Kill Counter",
            
            // Society and Faction Quests
            ["celestialhandintroductioncomplete"] = "Celestial Hand Introduction Complete",
            ["eldrytchwebintroductioncomplete"] = "Eldrytch Web Introduction Complete",
            ["radiantbloodintroductioncomplete"] = "Radiant Blood Introduction Complete",
            ["celestialhandinitiatetest"] = "Celestial Hand Initiate Test",
            ["eldrytchwebinitiatetest"] = "Eldrytch Web Initiate Test", 
            ["radiantbloodinitiatetest"] = "Radiant Blood Initiate Test",
            
            // Luminance Aura Related
            ["aetheriaredemption"] = "Aetheria Redemption",
            ["aegisofmerc"] = "Aegis of Merc",
            ["lumaugtradein"] = "Luminance Augmentation Trade In",
            
            // Common AC Quests
            ["holtburgtraderskill"] = "Holtburg Trader Skill Quest",
            ["shoushitraderskill"] = "Shoushi Trader Skill Quest",
            ["yaraqtraderskill"] = "Yaraq Trader Skill Quest",
            ["newbiequests"] = "Newbie Academy Quests",
            ["moarsmanraid"] = "Moarsman Raid",
            ["virindiparadox"] = "Virindi Paradox",
            ["portalspace"] = "Portal Space Exploration"
        };
        
        /// <summary>
        /// Get friendly name for a quest stamp, with fallback to original stamp
        /// </summary>
        /// <param name="questStamp">The quest stamp to lookup</param>
        /// <returns>Friendly name if found, otherwise the original quest stamp</returns>
        public static string GetFriendlyName(string questStamp)
        {
            if (string.IsNullOrEmpty(questStamp))
                return questStamp;
                
            return QuestStampToName.TryGetValue(questStamp.ToLower(), out string friendlyName) 
                ? friendlyName 
                : questStamp;
        }
        
        /// <summary>
        /// Get display name with friendly name and original stamp in parentheses
        /// </summary>
        /// <param name="questStamp">The quest stamp to format</param>
        /// <returns>Formatted display name</returns>
        public static string GetDisplayName(string questStamp)
        {
            if (string.IsNullOrEmpty(questStamp))
                return questStamp;
                
            string friendlyName = GetFriendlyName(questStamp);
            
            // If we found a mapping, show friendly name with original in parentheses
            if (!string.Equals(friendlyName, questStamp, System.StringComparison.OrdinalIgnoreCase))
            {
                return $"{friendlyName} ({questStamp})";
            }
            
            // Otherwise just show the original
            return questStamp;
        }
    }
}