using System.Collections.Generic;

namespace Nox.Game {
    public class PartyCreatorModel {
        private readonly ICharacterFactory characterFactory;
        private readonly IPartyFactory partyFactory;
        public PartyCreatorModel(ICharacterFactory characterFactory, IPartyFactory partyFactory, DefaultPartySettings defaultPartySettings) {
            this.characterFactory = characterFactory;
            this.partyFactory = partyFactory;
        }
        public PartyDefinition CreatePartyForNewRun(int companionCount) {
            var protagonist = characterFactory.CreateCustomProtagonist(new CustomCharacterCreationRequest {
                id = "protagonist",
                displayName = "The Warden",
                attributes = new EntityAttributes(),
                perksData = new PerksData(){
                    perks = new List<PerkDefinition>()
                }
            });

            CharacterTemplate[] companionTemplates = {
                // new() {
                //     id = "companion-bruiser",
                //     displayName = "Rook",
                //     attributes = new EntityAttributes { might = 5, reflex = 2, knowledge = 1 },
                //     perksData = new PerksData(){
                //         perks = new List<PerkDefinition>()
                //     }
                // },
                // new() {
                //     id = "companion-scout",
                //     displayName = "Sable",
                //     attributes = new EntityAttributes { might = 2, reflex = 5, knowledge = 1 },
                //     perksData = new PerksData(){
                //         perks = new List<PerkDefinition>()
                //     }
                // },
                // new() {
                //     id = "companion-scholar",
                //     displayName = "Quill",
                //     attributes = new EntityAttributes { might = 1, reflex = 2, knowledge = 5 },
                //     perksData = new PerksData(){
                //         perks = new List<PerkDefinition>()
                //     }
                // },
                // new() {
                //     id = "companion-vanguard",
                //     displayName = "Brant",
                //     attributes = new EntityAttributes { might = 4, reflex = 3, knowledge = 2 },
                //     perksData = new PerksData(){
                //         perks = new List<PerkDefinition>()
                //     }
                // },
                // new() {
                //     id = "companion-tracker",
                //     displayName = "Mira",
                //     attributes = new EntityAttributes { might = 2, reflex = 4, knowledge = 3 },
                //     perksData = new PerksData(){
                //         perks = new List<PerkDefinition>()
                //     }
                // }
            };

            var companions = new List<CharacterDefinition>();
            for(var i = 0; i < companionCount && i < companionTemplates.Length; i++) {
                companions.Add(characterFactory.CreateFromTemplate(companionTemplates[i], CharacterRole.Companion));
            }

            return partyFactory.Create(protagonist, companions);
        }
    }
}
