using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MarketData.Utils;
using System.IO;

namespace MarketData.CNNProcessing
{
  public class TestCases : List<TestCase>
	{
	}
	public class TestCase
	{
    public enum CaseType{Training,Test,Validation};
		public enum GenerateType{Price,BollingerBand};
		public enum OutputType{OutputFile,OutputStream}
		private readonly List<Stream> streams=new List<Stream>();
		private readonly List<String> pathFileNames=new List<String>();
		private readonly List<String> responses=new List<String>();
		/// <summary>
		/// ProcessData item
		/// </summary>
		///<param name="symbol">Symbol</param>
		///<param name="startDate">The start datee.</param>
		///<param name="purchaseDate">The purchasedate.</param>
	  public TestCase(String symbol,DateTime purchaseDate, int dayCount,TestCase.CaseType caseType,TestCase.GenerateType generateType=TestCase.GenerateType.Price,OutputType outputType=OutputType.OutputFile)
		{
		  DateGenerator dateGenerator=new DateGenerator();
		  this.Symbol=symbol;
			this.HistDate=dateGenerator.GenerateHistoricalDate(purchaseDate,dayCount);
			this.PurchaseDate=dateGenerator.GetNextBusinessDay(purchaseDate);
			this.TypeCase=caseType;
			TypeGenerate=generateType;
			TypeOutput=outputType;
      DayCount=dayCount;
		}

		public String Symbol{get;set;}
		public DateTime PurchaseDate{get;set;}
		public DateTime HistDate{get;set;}
		public CaseType TypeCase{get;set;}
    public int DayCount{get;private set;}
		public GenerateType TypeGenerate{get;set;}
		public OutputType TypeOutput{get;set;}
		public List<Stream> Streams{get{return streams;}}						         // This will get set automatically depending on OutputType
		public List<String> PathFileNames{get{return pathFileNames;}}   		 // This will get set automaticall depending on OutputType
		public List<String> Responses{get{return responses;}}
		public Stream LastStream{get{return Streams.Count>0?Streams[Streams.Count-1]:null;}}
		public String LastPathFileName{get{return PathFileNames.Count>0?PathFileNames[PathFileNames.Count-1]:null;}}
		public String LastResponse{get{return Responses.Count>0?Responses[Responses.Count-1]:null;}}
		public override String ToString()
		{
		  StringBuilder sb=new StringBuilder();
			if(OutputType.OutputFile.Equals(TypeOutput))return LastPathFileName;
			sb.Append(String.Format("{0}:P:{1}->H:{2}",Symbol,PurchaseDate.ToShortDateString(),HistDate.ToShortDateString()));
			return sb.ToString();
		}
	}
}
