using System;
using System.Text;
using System.Collections.Generic;
using MarketData.Utils;
using MarketData.Numerical;

namespace MarketData.MarketDataModel
{
  public class InsiderTransactionSummaries : List<InsiderTransactionSummary>
  {
    public InsiderTransactionSummaries(List<InsiderTransactionSummary> insiderTransactionSummaries)
    {
      foreach(InsiderTransactionSummary insiderTransactionSummary in insiderTransactionSummaries)Add(insiderTransactionSummary);
    }
    public InsiderTransactionSummaries()
    {
    }
  }
  public class InsiderTransactionSummary : IComparable, IBinValueExtractor
  {
    public String Symbol{get;set;}
    public DateTime TransactionDate{get;set;}
    public double NumberOfSharesAcquiredDisposed{get;set;}
		public double BinValue()
		{
			return NumberOfSharesAcquiredDisposed;
		}
    public int CompareTo(Object item)
    {
      InsiderTransactionSummary other=(InsiderTransactionSummary)item;
      return NumberOfSharesAcquiredDisposed.CompareTo(other.NumberOfSharesAcquiredDisposed);
    }
  }
  public class InsiderTransactions : List<InsiderTransaction>
  {
  }
  public class InsiderTransaction
  {
    public String Symbol { get; set; }
    public DateTime FilingDate { get; set; }
    public DateTime TransactionDate { get; set; }
    public String InsiderName { get; set; }
    public String OwnershipType { get; set; }
    public String Securities { get; set; }
    public String NatureOfTransaction { get; set; }
    public double NumberOrValueAcquiredDisposed { get; set; }
    public double Price { get; set; }
    public String Form { get; set; }
    public String SECAccessionNumber { get; set; }
    public String FormRowNumber { get; set; }
    public DateTime Modified { get;set; }
    public static String Header
    {
      get
      {
        StringBuilder sb=new StringBuilder();
        sb.Append("Symbol,FilingDSate,TransactionDate,InsiderName,OwnershipType,Securities,NatureOfTransaction,NumberOrValueAcquiredDisposed,Price,Form,SECAccessionNumber,FormRowNumber,Modified");
        return sb.ToString();
      }
    }
    public override string ToString()
    {
      StringBuilder sb=new StringBuilder();
      sb.Append(Utility.AddQuotes(Symbol)).Append(",");
      sb.Append(Utility.AddQuotes(FilingDate.ToShortDateString())).Append(",");
      sb.Append(Utility.AddQuotes(TransactionDate.ToShortDateString())).Append(",");
      sb.Append(Utility.AddQuotes(InsiderName)).Append(",");
      sb.Append(Utility.AddQuotes(OwnershipType)).Append(",");
      sb.Append(Utility.AddQuotes(Securities)).Append(",");
      sb.Append(Utility.AddQuotes(NatureOfTransaction)).Append(",");
      sb.Append(Utility.AddQuotes(Utility.FormatNumber(NumberOrValueAcquiredDisposed,2,true))).Append(",");
      sb.Append(Utility.AddQuotes(Utility.FormatNumber(Price,2,true))).Append(",");
      sb.Append(Utility.AddQuotes(Form)).Append(",");
      sb.Append(Utility.AddQuotes(SECAccessionNumber)).Append(",");
      sb.Append(Utility.AddQuotes(FormRowNumber)).Append(",");
      sb.Append(Utility.AddQuotes(Modified.ToShortDateString()));
      return sb.ToString();
    }
  }
 }
