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

namespace eagle.Notifications {
    using HeroId = Int32;

    public static class RiotSuppressedNotificationGenerator {
        public static readonly NotificationGenerator Generator = GenerateNotification;

        private static IEnumerable<Notification> GenerateNotification(
                ActionResultView actionResultView,
                IGameModel currentModel) {
            var province = currentModel.Provinces[actionResultView.Province.Value];
            HeroView leader = null;
            if (province.FullInfo != null && province.FullInfo.RulingHeroId is HeroId rulingHid) {
                leader = currentModel.Heroes[rulingHid];
            }
            string noteTitle = "Riot Suppressed";
            string noteText = $"We have crushed the attempted riot in {province.Name}.";

            yield return new Notification(
                    title: noteTitle,
                    text: noteText,
                    singleProvinceId: province.Id,
                    singleDisplayedHero: leader);
        }
    }
}