//------------------------------------------------------------------------------
// <auto-generated />
//
// 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.
//------------------------------------------------------------------------------

namespace QuantLib {

public class OvernightIndexedSwapIndex : SwapIndex {
  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
  private bool swigCMemOwnDerived;

  internal OvernightIndexedSwapIndex(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NQuantLibcPINVOKE.OvernightIndexedSwapIndex_SWIGSmartPtrUpcast(cPtr), true) {
    swigCMemOwnDerived = cMemoryOwn;
    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
  }

  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(OvernightIndexedSwapIndex obj) {
    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
  }

  protected override void Dispose(bool disposing) {
    lock(this) {
      if (swigCPtr.Handle != global::System.IntPtr.Zero) {
        if (swigCMemOwnDerived) {
          swigCMemOwnDerived = false;
          NQuantLibcPINVOKE.delete_OvernightIndexedSwapIndex(swigCPtr);
        }
        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
      }
      base.Dispose(disposing);
    }
  }

  public OvernightIndexedSwapIndex(string familyName, Period tenor, uint settlementDays, Currency currency, OvernightIndex overnightIndex, bool telescopicValueDates, RateAveraging.Type averagingMethod) : this(NQuantLibcPINVOKE.new_OvernightIndexedSwapIndex__SWIG_0(familyName, Period.getCPtr(tenor), settlementDays, Currency.getCPtr(currency), OvernightIndex.getCPtr(overnightIndex), telescopicValueDates, (int)averagingMethod), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public OvernightIndexedSwapIndex(string familyName, Period tenor, uint settlementDays, Currency currency, OvernightIndex overnightIndex, bool telescopicValueDates) : this(NQuantLibcPINVOKE.new_OvernightIndexedSwapIndex__SWIG_1(familyName, Period.getCPtr(tenor), settlementDays, Currency.getCPtr(currency), OvernightIndex.getCPtr(overnightIndex), telescopicValueDates), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public OvernightIndexedSwapIndex(string familyName, Period tenor, uint settlementDays, Currency currency, OvernightIndex overnightIndex) : this(NQuantLibcPINVOKE.new_OvernightIndexedSwapIndex__SWIG_2(familyName, Period.getCPtr(tenor), settlementDays, Currency.getCPtr(currency), OvernightIndex.getCPtr(overnightIndex)), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public OvernightIndex overnightIndex() {
    global::System.IntPtr cPtr = NQuantLibcPINVOKE.OvernightIndexedSwapIndex_overnightIndex(swigCPtr);
    OvernightIndex ret = (cPtr == global::System.IntPtr.Zero) ? null : new OvernightIndex(cPtr, true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public OvernightIndexedSwap underlyingSwap(Date fixingDate) {
    global::System.IntPtr cPtr = NQuantLibcPINVOKE.OvernightIndexedSwapIndex_underlyingSwap(swigCPtr, Date.getCPtr(fixingDate));
    OvernightIndexedSwap ret = (cPtr == global::System.IntPtr.Zero) ? null : new OvernightIndexedSwap(cPtr, true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
