using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MarketData.MarketDataModel
{
  public class SEC13Info
  {
    public SEC13Info()
    {
      SEC13=false;
    }
    public String Symbol{get;set;}
    public bool SEC13{get;set;}
    public DateTime MostRecentFilingDate{get;set;}
    public int Filings{get;set;}
  }
  public class SECFilings : List<SECFiling>
  {
    public SECFilings()
    {
    }
    public SECFilings(List<SECFiling> secFilings)
    {
      foreach(SECFiling secFiling in secFilings)Add(secFiling);
    }
    public SECFilings Distinct()
    {
      Dictionary<String,SECFiling> uniqueSECFilings=new Dictionary<String,SECFiling>();
      foreach(SECFiling secFiling in this)
      {
        String key=secFiling.Symbol+secFiling.SECAccessionNumber+secFiling.Sequence.ToString()+secFiling.FilingDate.ToShortDateString();
        if(!uniqueSECFilings.ContainsKey(key))uniqueSECFilings.Add(key,secFiling);
      }                                                       
      return new SECFilings(new List<SECFiling>(uniqueSECFilings.Values));
    }
  }                                                          
  public class SECFiling
  {
    private int sequence;
    private String secAccessionNumber;                         
    private String symbol;
    private DateTime filingDate;
    private String form;
    private String formText;
    private String description;
    private String fileNumber;
    private String secFilingUrl;

    public SECFiling()
    {
    }
    public String SECAccessionNumber
    {
      get { return secAccessionNumber; }
      set { secAccessionNumber = value; }
    }
    public int Sequence
    {
      get { return sequence; }
      set { sequence = value; }
    }
    public String Symbol
    {
      get { return symbol; }
      set { symbol = value; }
    }
    public String Form
    {
      get { return form; }
      set { form = value; }
    }
    public String FormText
    {
      get { return formText; }
      set { formText = value; }
    }
    public int FormTextLength
    {
      get { return formText.Length; }
    }
    public String Description
    {
      get { return description; }
      set { description = value; }
    }
    public DateTime FilingDate
    {
      get { return filingDate; }
      set { filingDate = value; }
    }
    public String FileNumber
    {
      get { return fileNumber; }
      set { fileNumber = value; }
    }
    public String SecFilingUrl
    {
      get { return secFilingUrl; }
      set { secFilingUrl = value; }
    }
  }
}
