﻿using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CodeTriangle.Abstract;
using CodeTriangle.DI;
using Kata.Core.Formulas.Abstract;
using Ninject;

//projecteuler.net/problem=42

namespace CodeTriangle
{
    class Program
    {
        private static ICodeTriangleNew _service;
        static void Main(string[] args)
        {
            var kernel = new StandardKernel(new CodeTriangleNinject());
            var service = kernel.Get<ICodeTriangleNew>();
            var isTriangularCount = 0;
            var isNotTriangularCount = 0;
            
            service.ReadWordsFromFile("words.txt");

            var wordCount = service.WordCount();

            Console.WriteLine("Total number of words: {0}", wordCount);
            foreach (var word in service.Words)
            {
                var isTriangular = service.IsWordTriangular(word);
                Console.WriteLine("Current Work is {0}", word);
                Console.WriteLine("The numeric value for the word: {0} is {1}",word, service.CovertWordToNumber(word).Sum());
                Console.WriteLine("Is word triangular? {0}", isTriangular);

                if (isTriangular)
                {
                    isTriangularCount++;
                }
                else
                {
                    isNotTriangularCount++;
                }

            }
            Console.WriteLine("Total Triangular: {0}",isTriangularCount);
            Console.WriteLine("Total Not Triangular: {0}", isNotTriangularCount);
            Console.ReadLine();
        }
    }
}
