﻿using System.Collections.Generic;
using System.IO;
using NanoPlay.Logic.Games;

namespace NanoPlay.Logic.Content
{
    public class Group : Item
    {
        public ICollection<Player> Players { get; }
        public ICollection<Topic> Topics { get; }
        public ICollection<GameFactory> Games { get; }

        public Group(string dataDir) : base(dataDir)
        {
            Players = Player.LoadSet(Path.Combine(dataDir, "Players"));
            Topics = Topic.LoadSet(Path.Combine(dataDir, "Topics"));
            Games = GameFactory.LoadSet(Path.Combine(dataDir, "Games"));
        }

        public static ICollection<Group> LoadSet(string dataDir) => Utils.DirsToList(dataDir, x => new Group(x));
    }
}