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

namespace TradeBlotter.Model
{
  public class BlotterTradeModel : PortfolioTrade
  {
    public static BlotterTradeModel CreateTrade()
    {
      BlotterTradeModel trade = new BlotterTradeModel();
      trade.TradeDate = DateTime.Now;
      trade.Price = 0.0;
      return trade;
    }
    protected BlotterTradeModel()
    {
    }
    public BlotterTradeModel Clone()
    {
      BlotterTradeModel blotterTradeModel = CreateTrade();
      blotterTradeModel.TradeId=TradeId;
      blotterTradeModel.Symbol = Symbol;
      blotterTradeModel.TradeDate = TradeDate;
      blotterTradeModel.Shares = Shares;
      blotterTradeModel.Price = Price;
      blotterTradeModel.Commission = Commission;
      blotterTradeModel.BuySell = BuySell;
      blotterTradeModel.Account = Account;
      blotterTradeModel.Status = Status;
      blotterTradeModel.CompanyName = CompanyName;
      blotterTradeModel.LatestPrice = LatestPrice;
      blotterTradeModel.PriceDate = PriceDate;
      blotterTradeModel.HasLatestPrice = HasLatestPrice;
      blotterTradeModel.SellDate = SellDate;
      blotterTradeModel.SellPrice = SellPrice;
      return blotterTradeModel;
    }
    public void CopyFrom(BlotterTradeModel trade)
    {
      TradeId = trade.TradeId;
      Symbol = trade.Symbol;
      TradeDate = trade.TradeDate;
      Shares = trade.Shares;
      Price = trade.Price;
      Commission = trade.Commission;
      BuySell = trade.BuySell;
      Account = trade.Account;
      Status = trade.Status;
      CompanyName = trade.CompanyName;
      LatestPrice = trade.LatestPrice;
      PriceDate = trade.PriceDate;
      HasLatestPrice = trade.HasLatestPrice;
      SellDate = trade.SellDate;
      SellPrice = trade.SellPrice;
    }
    public String CompanyName { get; set; }
    public new double Exposure { get { return Price * Shares; } }
    public double LatestPrice { get; set; }
    public DateTime PriceDate { get; set; }
    public Boolean HasLatestPrice{get;set;}
  }
}
