defmodule Ibex.Contracts.Contract do
  defstruct [
    :con_id,
    :symbol,
    :sec_type,
    :last_trade_date_or_contract_month,
    :strike,
    :right,
    :multiplier,
    :exchange,
    :primary_exchange,
    :currency,
    :localSYmbol,
    :trading_class,
    :include_expired,
    :sec_id_type,
    :sec_id,
    :description,
    :issuer_id,
    :combo_legs_descrip,
    :combo_legs,
    :delta_neutral_contract
  ]

  def t() do
    %__MODULE__{}
  end
end

defmodule Ibex.Contracts.ContractDescription do
  defstruct [:contract, :derivative_sec_types]

  def t() do
    %__MODULE__{
      contract: Ibex.Contracts.Contract.t(),
      derivative_sec_types: []
    }
  end

  def insert_derivative_types(cd, derivs) do
    Map.put(cd, :derivative_sec_types, derivs)
  end

  def insert_into_contract(cd, field, value) do
    contract = Map.get(cd, :contract)
    contract = Map.put(contract, field, value)
    Map.put(cd, :contract, contract)
  end
end