using System.Collections.Generic;
using Net.Eagle0.Eagle.Views;

namespace eagle.Notifications {
    public static class FailedSwearBrotherhoodNotificationGenerator {
        public static readonly NotificationGenerator Generator = GenerateNotification;

        private static class Placeholders {
            public static readonly DynamicTextPlaceholderName DecliningHero =
                    new(nameof(DecliningHero));
        }

        private static IEnumerable<Notification> GenerateNotification(
                ActionResultView actionResultView,
                IGameModel currentModel) {
            var hero = currentModel.Heroes[actionResultView.Leader.Value];
            var textTemplate = DynamicTextTemplate.Parsed(
                    $"{DynamicTextTemplate.Placeholder(Placeholders.DecliningHero)} feels you are too different to swear eternal brotherhood.");

            var heroPlaceholders = new List<DynamicPlaceholder> {
                DynamicPlaceholder.HeroName(Placeholders.DecliningHero, hero, "The hero")
            };

            yield return new DynamicTextNotification(
                    title: "Oath Declined",
                    textTemplate: textTemplate,
                    placeholders: heroPlaceholders,
                    singleProvinceId: actionResultView.GameStateDiff.ChangedProvinces[0].Id,
                    displayedHeroes: new List<HeroView> { hero });
        }
    }
}
