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

namespace QuantLib {

public class YoYInflationIndex : InflationIndex {
  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
  private bool swigCMemOwnDerived;

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

  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(YoYInflationIndex 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_YoYInflationIndex(swigCPtr);
        }
        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
      }
      base.Dispose(disposing);
    }
  }

  public YoYInflationIndex(string familyName, Region region, bool revised, bool interpolated, bool ratio, Frequency frequency, Period availabilityLag, Currency currency, YoYInflationTermStructureHandle ts) : this(NQuantLibcPINVOKE.new_YoYInflationIndex__SWIG_0(familyName, Region.getCPtr(region), revised, interpolated, ratio, (int)frequency, Period.getCPtr(availabilityLag), Currency.getCPtr(currency), YoYInflationTermStructureHandle.getCPtr(ts)), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public YoYInflationIndex(string familyName, Region region, bool revised, bool interpolated, bool ratio, Frequency frequency, Period availabilityLag, Currency currency) : this(NQuantLibcPINVOKE.new_YoYInflationIndex__SWIG_1(familyName, Region.getCPtr(region), revised, interpolated, ratio, (int)frequency, Period.getCPtr(availabilityLag), Currency.getCPtr(currency)), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public bool ratio() {
    bool ret = NQuantLibcPINVOKE.YoYInflationIndex_ratio(swigCPtr);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public YoYInflationTermStructureHandle yoyInflationTermStructure() {
    YoYInflationTermStructureHandle ret = new YoYInflationTermStructureHandle(NQuantLibcPINVOKE.YoYInflationIndex_yoyInflationTermStructure(swigCPtr), true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public YoYInflationIndex clone(YoYInflationTermStructureHandle h) {
    global::System.IntPtr cPtr = NQuantLibcPINVOKE.YoYInflationIndex_clone(swigCPtr, YoYInflationTermStructureHandle.getCPtr(h));
    YoYInflationIndex ret = (cPtr == global::System.IntPtr.Zero) ? null : new YoYInflationIndex(cPtr, true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
