using System;
using System.Collections.Generic;
using System.Linq;
using TradeBlotter.Views;
using MarketData.MarketDataModel;
using MarketData.Generator;
using Microsoft.Research.DynamicDataDisplay.DataSources;

namespace TradeBlotter.Model
{
  public class InsiderTransactionModel
  {
    private InsiderTransactionModel()
    {
    }
    public static CompositeDataSource InsiderTransactionSummaries(InsiderTransactionSummaries insiderTransactionSummaries,double minPrice)
    {
      if (null == insiderTransactionSummaries) return null;
      CompositeDataSource compositeDataSource;
      var xData = new EnumerableDataSource<DateTime>(insiderTransactionSummaries.Select(x => x.TransactionDate.Date));
      xData.SetXMapping(x => (x.Ticks / 10000000000.0));
      var yData = new EnumerableDataSource<double>(insiderTransactionSummaries.Select(y=>minPrice)); 
      yData.SetYMapping(y => y);
      compositeDataSource = xData.Join(yData);
      return compositeDataSource;
    }
  }
}
