/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (https://www.swig.org).
 * Version 4.1.0
 *
 * Do not make changes to this file unless you know what you are doing - modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.quantlib;

public class ForwardRateAgreement extends Instrument {
  private transient long swigCPtr;
  private transient boolean swigCMemOwnDerived;

  protected ForwardRateAgreement(long cPtr, boolean cMemoryOwn) {
    super(QuantLibJNI.ForwardRateAgreement_SWIGSmartPtrUpcast(cPtr), true);
    swigCMemOwnDerived = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(ForwardRateAgreement obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void swigSetCMemOwn(boolean own) {
    swigCMemOwnDerived = own;
    super.swigSetCMemOwn(own);
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwnDerived) {
        swigCMemOwnDerived = false;
        QuantLibJNI.delete_ForwardRateAgreement(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public ForwardRateAgreement(Date valueDate, Date maturityDate, Position.Type type, double strikeForwardRate, double notionalAmount, IborIndex index, YieldTermStructureHandle discountCurve, boolean useIndexedCoupon) {
    this(QuantLibJNI.new_ForwardRateAgreement__SWIG_0(Date.getCPtr(valueDate), valueDate, Date.getCPtr(maturityDate), maturityDate, type.swigValue(), strikeForwardRate, notionalAmount, IborIndex.getCPtr(index), index, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, useIndexedCoupon), true);
  }

  public ForwardRateAgreement(Date valueDate, Date maturityDate, Position.Type type, double strikeForwardRate, double notionalAmount, IborIndex index, YieldTermStructureHandle discountCurve) {
    this(QuantLibJNI.new_ForwardRateAgreement__SWIG_1(Date.getCPtr(valueDate), valueDate, Date.getCPtr(maturityDate), maturityDate, type.swigValue(), strikeForwardRate, notionalAmount, IborIndex.getCPtr(index), index, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve), true);
  }

  public ForwardRateAgreement(Date valueDate, Date maturityDate, Position.Type type, double strikeForwardRate, double notionalAmount, IborIndex index) {
    this(QuantLibJNI.new_ForwardRateAgreement__SWIG_2(Date.getCPtr(valueDate), valueDate, Date.getCPtr(maturityDate), maturityDate, type.swigValue(), strikeForwardRate, notionalAmount, IborIndex.getCPtr(index), index), true);
  }

  public ForwardRateAgreement(Date valueDate, Position.Type type, double strikeForwardRate, double notionalAmount, IborIndex index, YieldTermStructureHandle discountCurve) {
    this(QuantLibJNI.new_ForwardRateAgreement__SWIG_3(Date.getCPtr(valueDate), valueDate, type.swigValue(), strikeForwardRate, notionalAmount, IborIndex.getCPtr(index), index, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve), true);
  }

  public ForwardRateAgreement(Date valueDate, Position.Type type, double strikeForwardRate, double notionalAmount, IborIndex index) {
    this(QuantLibJNI.new_ForwardRateAgreement__SWIG_4(Date.getCPtr(valueDate), valueDate, type.swigValue(), strikeForwardRate, notionalAmount, IborIndex.getCPtr(index), index), true);
  }

  public double amount() {
    return QuantLibJNI.ForwardRateAgreement_amount(swigCPtr, this);
  }

  public Date fixingDate() {
    return new Date(QuantLibJNI.ForwardRateAgreement_fixingDate(swigCPtr, this), true);
  }

  public InterestRate forwardRate() {
    return new InterestRate(QuantLibJNI.ForwardRateAgreement_forwardRate(swigCPtr, this), true);
  }

  public double spotIncome(YieldTermStructureHandle discount) {
    return QuantLibJNI.ForwardRateAgreement_spotIncome(swigCPtr, this, YieldTermStructureHandle.getCPtr(discount), discount);
  }

  public double spotValue() {
    return QuantLibJNI.ForwardRateAgreement_spotValue(swigCPtr, this);
  }

}
