/* ----------------------------------------------------------------------------
 * 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 IsdaCdsEngine extends PricingEngine {
  private transient long swigCPtr;
  private transient boolean swigCMemOwnDerived;

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

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

  public IsdaCdsEngine(DefaultProbabilityTermStructureHandle probability, double recoveryRate, YieldTermStructureHandle discountCurve, boolean includeSettlementDateFlows, IsdaCdsEngine.NumericalFix numericalFix, IsdaCdsEngine.AccrualBias accrualBias, IsdaCdsEngine.ForwardsInCouponPeriod forwardsInCouponPeriod) {
    this(QuantLibJNI.new_IsdaCdsEngine__SWIG_0(DefaultProbabilityTermStructureHandle.getCPtr(probability), probability, recoveryRate, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, includeSettlementDateFlows, numericalFix.swigValue(), accrualBias.swigValue(), forwardsInCouponPeriod.swigValue()), true);
  }

  public IsdaCdsEngine(DefaultProbabilityTermStructureHandle probability, double recoveryRate, YieldTermStructureHandle discountCurve, boolean includeSettlementDateFlows, IsdaCdsEngine.NumericalFix numericalFix, IsdaCdsEngine.AccrualBias accrualBias) {
    this(QuantLibJNI.new_IsdaCdsEngine__SWIG_1(DefaultProbabilityTermStructureHandle.getCPtr(probability), probability, recoveryRate, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, includeSettlementDateFlows, numericalFix.swigValue(), accrualBias.swigValue()), true);
  }

  public IsdaCdsEngine(DefaultProbabilityTermStructureHandle probability, double recoveryRate, YieldTermStructureHandle discountCurve, boolean includeSettlementDateFlows, IsdaCdsEngine.NumericalFix numericalFix) {
    this(QuantLibJNI.new_IsdaCdsEngine__SWIG_2(DefaultProbabilityTermStructureHandle.getCPtr(probability), probability, recoveryRate, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, includeSettlementDateFlows, numericalFix.swigValue()), true);
  }

  public IsdaCdsEngine(DefaultProbabilityTermStructureHandle probability, double recoveryRate, YieldTermStructureHandle discountCurve, boolean includeSettlementDateFlows) {
    this(QuantLibJNI.new_IsdaCdsEngine__SWIG_3(DefaultProbabilityTermStructureHandle.getCPtr(probability), probability, recoveryRate, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, includeSettlementDateFlows), true);
  }

  public IsdaCdsEngine(DefaultProbabilityTermStructureHandle probability, double recoveryRate, YieldTermStructureHandle discountCurve) {
    this(QuantLibJNI.new_IsdaCdsEngine__SWIG_4(DefaultProbabilityTermStructureHandle.getCPtr(probability), probability, recoveryRate, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve), true);
  }

  public final static class NumericalFix {
    public final static IsdaCdsEngine.NumericalFix None = new IsdaCdsEngine.NumericalFix("None");
    public final static IsdaCdsEngine.NumericalFix Taylor = new IsdaCdsEngine.NumericalFix("Taylor");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static NumericalFix swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + NumericalFix.class + " with value " + swigValue);
    }

    private NumericalFix(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private NumericalFix(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private NumericalFix(String swigName, NumericalFix swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static NumericalFix[] swigValues = { None, Taylor };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class AccrualBias {
    public final static IsdaCdsEngine.AccrualBias HalfDayBias = new IsdaCdsEngine.AccrualBias("HalfDayBias");
    public final static IsdaCdsEngine.AccrualBias NoBias = new IsdaCdsEngine.AccrualBias("NoBias");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static AccrualBias swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + AccrualBias.class + " with value " + swigValue);
    }

    private AccrualBias(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private AccrualBias(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private AccrualBias(String swigName, AccrualBias swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static AccrualBias[] swigValues = { HalfDayBias, NoBias };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class ForwardsInCouponPeriod {
    public final static IsdaCdsEngine.ForwardsInCouponPeriod Flat = new IsdaCdsEngine.ForwardsInCouponPeriod("Flat");
    public final static IsdaCdsEngine.ForwardsInCouponPeriod Piecewise = new IsdaCdsEngine.ForwardsInCouponPeriod("Piecewise");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static ForwardsInCouponPeriod swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + ForwardsInCouponPeriod.class + " with value " + swigValue);
    }

    private ForwardsInCouponPeriod(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private ForwardsInCouponPeriod(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private ForwardsInCouponPeriod(String swigName, ForwardsInCouponPeriod swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static ForwardsInCouponPeriod[] swigValues = { Flat, Piecewise };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
