/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (https://www.swig.org).
 * Version 4.1.1
 *
 * 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 ZeroCouponSwap extends Swap {
  private transient long swigCPtr;
  private transient boolean swigCMemOwnDerived;

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

  protected static long getCPtr(ZeroCouponSwap 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_ZeroCouponSwap(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public ZeroCouponSwap(Swap.Type type, double baseNominal, Date startDate, Date maturityDate, double fixedPayment, IborIndex iborIndex, Calendar paymentCalendar, BusinessDayConvention paymentConvention, long paymentDelay) {
    this(QuantLibJNI.new_ZeroCouponSwap__SWIG_0(type.swigValue(), baseNominal, Date.getCPtr(startDate), startDate, Date.getCPtr(maturityDate), maturityDate, fixedPayment, IborIndex.getCPtr(iborIndex), iborIndex, Calendar.getCPtr(paymentCalendar), paymentCalendar, paymentConvention.swigValue(), paymentDelay), true);
  }

  public ZeroCouponSwap(Swap.Type type, double baseNominal, Date startDate, Date maturityDate, double fixedPayment, IborIndex iborIndex, Calendar paymentCalendar, BusinessDayConvention paymentConvention) {
    this(QuantLibJNI.new_ZeroCouponSwap__SWIG_1(type.swigValue(), baseNominal, Date.getCPtr(startDate), startDate, Date.getCPtr(maturityDate), maturityDate, fixedPayment, IborIndex.getCPtr(iborIndex), iborIndex, Calendar.getCPtr(paymentCalendar), paymentCalendar, paymentConvention.swigValue()), true);
  }

  public ZeroCouponSwap(Swap.Type type, double baseNominal, Date startDate, Date maturityDate, double fixedPayment, IborIndex iborIndex, Calendar paymentCalendar) {
    this(QuantLibJNI.new_ZeroCouponSwap__SWIG_2(type.swigValue(), baseNominal, Date.getCPtr(startDate), startDate, Date.getCPtr(maturityDate), maturityDate, fixedPayment, IborIndex.getCPtr(iborIndex), iborIndex, Calendar.getCPtr(paymentCalendar), paymentCalendar), true);
  }

  public ZeroCouponSwap(Swap.Type type, double baseNominal, Date startDate, Date maturityDate, double fixedRate, DayCounter fixedDayCounter, IborIndex iborIndex, Calendar paymentCalendar, BusinessDayConvention paymentConvention, long paymentDelay) {
    this(QuantLibJNI.new_ZeroCouponSwap__SWIG_3(type.swigValue(), baseNominal, Date.getCPtr(startDate), startDate, Date.getCPtr(maturityDate), maturityDate, fixedRate, DayCounter.getCPtr(fixedDayCounter), fixedDayCounter, IborIndex.getCPtr(iborIndex), iborIndex, Calendar.getCPtr(paymentCalendar), paymentCalendar, paymentConvention.swigValue(), paymentDelay), true);
  }

  public ZeroCouponSwap(Swap.Type type, double baseNominal, Date startDate, Date maturityDate, double fixedRate, DayCounter fixedDayCounter, IborIndex iborIndex, Calendar paymentCalendar, BusinessDayConvention paymentConvention) {
    this(QuantLibJNI.new_ZeroCouponSwap__SWIG_4(type.swigValue(), baseNominal, Date.getCPtr(startDate), startDate, Date.getCPtr(maturityDate), maturityDate, fixedRate, DayCounter.getCPtr(fixedDayCounter), fixedDayCounter, IborIndex.getCPtr(iborIndex), iborIndex, Calendar.getCPtr(paymentCalendar), paymentCalendar, paymentConvention.swigValue()), true);
  }

  public ZeroCouponSwap(Swap.Type type, double baseNominal, Date startDate, Date maturityDate, double fixedRate, DayCounter fixedDayCounter, IborIndex iborIndex, Calendar paymentCalendar) {
    this(QuantLibJNI.new_ZeroCouponSwap__SWIG_5(type.swigValue(), baseNominal, Date.getCPtr(startDate), startDate, Date.getCPtr(maturityDate), maturityDate, fixedRate, DayCounter.getCPtr(fixedDayCounter), fixedDayCounter, IborIndex.getCPtr(iborIndex), iborIndex, Calendar.getCPtr(paymentCalendar), paymentCalendar), true);
  }

  public Swap.Type type() {
    return Swap.Type.swigToEnum(QuantLibJNI.ZeroCouponSwap_type(swigCPtr, this));
  }

  public double baseNominal() {
    return QuantLibJNI.ZeroCouponSwap_baseNominal(swigCPtr, this);
  }

  public IborIndex iborIndex() {
    long cPtr = QuantLibJNI.ZeroCouponSwap_iborIndex(swigCPtr, this);
    return (cPtr == 0) ? null : new IborIndex(cPtr, true);
  }

  public Leg fixedLeg() {
    return new Leg(QuantLibJNI.ZeroCouponSwap_fixedLeg(swigCPtr, this), false);
  }

  public Leg floatingLeg() {
    return new Leg(QuantLibJNI.ZeroCouponSwap_floatingLeg(swigCPtr, this), false);
  }

  public double fixedPayment() {
    return QuantLibJNI.ZeroCouponSwap_fixedPayment(swigCPtr, this);
  }

  public double fixedLegNPV() {
    return QuantLibJNI.ZeroCouponSwap_fixedLegNPV(swigCPtr, this);
  }

  public double floatingLegNPV() {
    return QuantLibJNI.ZeroCouponSwap_floatingLegNPV(swigCPtr, this);
  }

  public double fairFixedPayment() {
    return QuantLibJNI.ZeroCouponSwap_fairFixedPayment(swigCPtr, this);
  }

  public double fairFixedRate(DayCounter dayCounter) {
    return QuantLibJNI.ZeroCouponSwap_fairFixedRate(swigCPtr, this, DayCounter.getCPtr(dayCounter), dayCounter);
  }

}
