//------------------------------------------------------------------------------
// <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 CmsMarket : global::System.IDisposable {
  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
  private bool swigCMemOwnBase;

  internal CmsMarket(global::System.IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwnBase = cMemoryOwn;
    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
  }

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

  ~CmsMarket() {
    Dispose(false);
  }

  public void Dispose() {
    Dispose(true);
    global::System.GC.SuppressFinalize(this);
  }

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

  public CmsMarket(PeriodVector swapLengths, SwapIndexVector swapIndexes, IborIndex iborIndex, QuoteHandleVectorVector bidAskSpreads, CmsCouponPricerVector pricers, YieldTermStructureHandle discountingTS) : this(NQuantLibcPINVOKE.new_CmsMarket(PeriodVector.getCPtr(swapLengths), SwapIndexVector.getCPtr(swapIndexes), IborIndex.getCPtr(iborIndex), QuoteHandleVectorVector.getCPtr(bidAskSpreads), CmsCouponPricerVector.getCPtr(pricers), YieldTermStructureHandle.getCPtr(discountingTS)), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public void reprice(SwaptionVolatilityStructureHandle volStructure, double meanReversion) {
    NQuantLibcPINVOKE.CmsMarket_reprice(swigCPtr, SwaptionVolatilityStructureHandle.getCPtr(volStructure), meanReversion);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public PeriodVector swapTenors() {
    PeriodVector ret = new PeriodVector(NQuantLibcPINVOKE.CmsMarket_swapTenors(swigCPtr), false);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public PeriodVector swapLengths() {
    PeriodVector ret = new PeriodVector(NQuantLibcPINVOKE.CmsMarket_swapLengths(swigCPtr), false);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Matrix impliedCmsSpreads() {
    Matrix ret = new Matrix(NQuantLibcPINVOKE.CmsMarket_impliedCmsSpreads(swigCPtr), false);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Matrix spreadErrors() {
    Matrix ret = new Matrix(NQuantLibcPINVOKE.CmsMarket_spreadErrors(swigCPtr), false);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Matrix browse() {
    Matrix ret = new Matrix(NQuantLibcPINVOKE.CmsMarket_browse(swigCPtr), true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public double weightedSpreadError(Matrix weights) {
    double ret = NQuantLibcPINVOKE.CmsMarket_weightedSpreadError(swigCPtr, Matrix.getCPtr(weights));
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public double weightedSpotNpvError(Matrix weights) {
    double ret = NQuantLibcPINVOKE.CmsMarket_weightedSpotNpvError(swigCPtr, Matrix.getCPtr(weights));
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public double weightedFwdNpvError(Matrix weights) {
    double ret = NQuantLibcPINVOKE.CmsMarket_weightedFwdNpvError(swigCPtr, Matrix.getCPtr(weights));
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public QlArray weightedSpreadErrors(Matrix weights) {
    QlArray ret = new QlArray(NQuantLibcPINVOKE.CmsMarket_weightedSpreadErrors(swigCPtr, Matrix.getCPtr(weights)), true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public QlArray weightedSpotNpvErrors(Matrix weights) {
    QlArray ret = new QlArray(NQuantLibcPINVOKE.CmsMarket_weightedSpotNpvErrors(swigCPtr, Matrix.getCPtr(weights)), true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public QlArray weightedFwdNpvErrors(Matrix weights) {
    QlArray ret = new QlArray(NQuantLibcPINVOKE.CmsMarket_weightedFwdNpvErrors(swigCPtr, Matrix.getCPtr(weights)), true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
