using System.Collections.Generic;
using System.Linq;
using TaskIt.Core;
using TaskIt.Infrastructure;
using TaskIt.Modules.Tasks.Assets.Resources;
using TaskIt.Modules.Tasks.ViewModels;
using TaskIt.Web;

namespace TaskIt.Modules.Tasks.Models
{
    public class TreeViewData : ViewModelBase
    {
        public static List<object> GetTreeViewData()
        {
            var taskCategories = new List<TaskCategory> {new TaskCategory {ID = 0, Name = TasksStrings.Node_AllCategories}};
            taskCategories.AddRange(Utils.DataContext.TaskCategories.ToList());
            var treeViewData = new List<object>
               {
                   new CategoriesTreeViewNodeModel
                       {
                           Name = TasksStrings.Node_TaskCategories,
                           Image = Utils.GetIconUri("Categories"),
                           Children = taskCategories
                       },
                   new ProjectsTreeViewNodeModel
                       {
                           Name = TasksStrings.Node_Projects,
                           Image = Utils.GetIconUri("Projects"),
                           Children = Utils.DataContext.Projects
                       },
                   new ContextsTreeViewNodeModel
                       {
                           Name = TasksStrings.Node_Contexts,
                           Image = Utils.GetIconUri("Contexts"),
                           Children = Utils.DataContext.Contexts
                       },
                   new ContactsTreeViewNodeModel
                       {
                           Name = TasksStrings.Node_Contacts,
                           Image = Utils.GetIconUri("People"),
                           Children = Utils.DataContext.Contacts
                       }
               };
            return treeViewData;
        }
    }
}
