using System.Linq;
using StubCore.Entities;
using System.Collections.Generic;

namespace StubCore.Plugins.DataCollector
{
    public class NamespaceCollector : FrontCollector
    {
        private readonly string sourceName;
        private readonly string namespFolder;

        public NamespaceCollector(string name, string folder) : base(name, folder)
        {
            sourceName = name;
            namespFolder = folder;
        }

        public List<Namespace> GetNodesforProfile(int id)
        {
            var _fileList = new List<Namespace>();
            var _list = GetFiles<Namespace>();

            if (_list.Count > 0)
            {
                _fileList = (_list.Where(node => node.profileID == id)).ToList<Namespace>();

                if (_fileList.Count == 0)
                {
                    _logger.NoItemsFoundForProfile(id, namespFolder);
                }
            }
            else
            {
                _logger.ItemsListNotExists(namespFolder);
            }

            return _fileList;

        }

    }
}
