using System;
using System.Collections.Generic;

namespace TradeBlotter.Model
{
  public class TradeResultList : List<TradeResult>
  {
    public TradeResultList()
    {
    }
  }
  public class TradeResult : IComparable
  {
    private DateTime tradeDate;
    private String buySell;
    private String symbol;
    private long shares;
    private double price;
    private double gainLoss;
    private double exposure;
    private double returnOnPosition;
    private long daysHeld;
    private String comment;

    public TradeResult(DateTime tradeDate, String buySell, String symbol, long shares, double price, double gainLoss, double returnOnPosition,double exposure,long daysHeld, String comment)
    {
      this.tradeDate = tradeDate;
      this.buySell = buySell;
      this.symbol = symbol;
      this.shares = shares;
      this.price = price;
      this.gainLoss = gainLoss;
      this.daysHeld = daysHeld;
      this.comment = comment;
      this.exposure = exposure;
      this.returnOnPosition = returnOnPosition;
    }
    public int CompareTo(Object o)
    {
      if (!o.GetType().Equals(typeof(TradeResult))) throw new Exception("Exected " + typeof(TradeResult));
      TradeResult thatResult = (TradeResult)o;
      return thatResult.TradeDate.CompareTo(tradeDate);
    }
    public DateTime TradeDate
    {
      get { return tradeDate; }
    }
    public String BuySell
    {
      get { return buySell; }
    }
    public String Symbol
    {
      get { return symbol; }
    }
    public long Shares
    {
      get { return shares; }
    }
    public double Price
    {
      get { return price; }
    }
    public double GainLoss
    {
      get { return gainLoss; }
    }
    public double Exposure
    {
      get { return exposure; }
    }
    public double Return
    {
      get { return returnOnPosition; }
    }
    public long DaysHeld
    {
      get { return daysHeld; }
    }
    public String Comment
    {
      get { return comment; }
    }
  }
  public class TradeResultSummary
  {
    private double portfolioValue;
    private double portfolioReturn;
    private double averageGainLoss;
    private double averageHoldingDays;
    private double minimumHoldingDays;
    private double maximumHoldingDays;

    public TradeResultSummary()
    {
    }
    public double PortfolioValue
    {
      get { return portfolioValue; }
      set { portfolioValue = value; }
    }
    public double PortfolioReturn
    {
      get { return portfolioReturn; }
      set { portfolioReturn = value; }
    }
    public double AverageGainLoss
    {
      get { return averageGainLoss; }
      set { averageGainLoss = value; }
    }
    public double AverageHoldingDays
    {
      get { return averageHoldingDays; }
      set { averageHoldingDays = value; }
    }
    public double MinimumHoldingDays
    {
      get { return minimumHoldingDays; }
      set { minimumHoldingDays = value; }
    }
    public double MaximumHoldingDays
    {
      get { return maximumHoldingDays; }
      set { maximumHoldingDays = value; }
    }
  }
}
