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

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

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

  ~Schedule() {
    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 (swigCMemOwn) {
          swigCMemOwn = false;
          NQuantLibcPINVOKE.delete_Schedule(swigCPtr);
        }
        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
      }
    }
  }

  public Schedule(DateVector arg0, Calendar calendar, BusinessDayConvention convention) : this(NQuantLibcPINVOKE.new_Schedule__SWIG_0(DateVector.getCPtr(arg0), Calendar.getCPtr(calendar), (int)convention), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public Schedule(DateVector arg0, Calendar calendar) : this(NQuantLibcPINVOKE.new_Schedule__SWIG_1(DateVector.getCPtr(arg0), Calendar.getCPtr(calendar)), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public Schedule(DateVector arg0) : this(NQuantLibcPINVOKE.new_Schedule__SWIG_2(DateVector.getCPtr(arg0)), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public Schedule(Date effectiveDate, Date terminationDate, Period tenor, Calendar calendar, BusinessDayConvention convention, BusinessDayConvention terminationDateConvention, DateGeneration.Rule rule, bool endOfMonth, Date firstDate, Date nextToLastDate) : this(NQuantLibcPINVOKE.new_Schedule__SWIG_3(Date.getCPtr(effectiveDate), Date.getCPtr(terminationDate), Period.getCPtr(tenor), Calendar.getCPtr(calendar), (int)convention, (int)terminationDateConvention, (int)rule, endOfMonth, Date.getCPtr(firstDate), Date.getCPtr(nextToLastDate)), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public Schedule(Date effectiveDate, Date terminationDate, Period tenor, Calendar calendar, BusinessDayConvention convention, BusinessDayConvention terminationDateConvention, DateGeneration.Rule rule, bool endOfMonth, Date firstDate) : this(NQuantLibcPINVOKE.new_Schedule__SWIG_4(Date.getCPtr(effectiveDate), Date.getCPtr(terminationDate), Period.getCPtr(tenor), Calendar.getCPtr(calendar), (int)convention, (int)terminationDateConvention, (int)rule, endOfMonth, Date.getCPtr(firstDate)), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public Schedule(Date effectiveDate, Date terminationDate, Period tenor, Calendar calendar, BusinessDayConvention convention, BusinessDayConvention terminationDateConvention, DateGeneration.Rule rule, bool endOfMonth) : this(NQuantLibcPINVOKE.new_Schedule__SWIG_5(Date.getCPtr(effectiveDate), Date.getCPtr(terminationDate), Period.getCPtr(tenor), Calendar.getCPtr(calendar), (int)convention, (int)terminationDateConvention, (int)rule, endOfMonth), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public Schedule() : this(NQuantLibcPINVOKE.new_Schedule__SWIG_6(), true) {
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
  }

  public uint size() {
    uint ret = NQuantLibcPINVOKE.Schedule_size(swigCPtr);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Date date(uint i) {
    Date ret = new Date(NQuantLibcPINVOKE.Schedule_date(swigCPtr, i), true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Date previousDate(Date refDate) {
    Date ret = new Date(NQuantLibcPINVOKE.Schedule_previousDate(swigCPtr, Date.getCPtr(refDate)), true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Date nextDate(Date refDate) {
    Date ret = new Date(NQuantLibcPINVOKE.Schedule_nextDate(swigCPtr, Date.getCPtr(refDate)), true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

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

  public bool isRegular(uint i) {
    bool ret = NQuantLibcPINVOKE.Schedule_isRegular__SWIG_0(swigCPtr, i);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public BoolVector isRegular() {
    BoolVector ret = new BoolVector(NQuantLibcPINVOKE.Schedule_isRegular__SWIG_1(swigCPtr), false);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Calendar calendar() {
    Calendar ret = new Calendar(NQuantLibcPINVOKE.Schedule_calendar(swigCPtr), false);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Date startDate() {
    Date ret = new Date(NQuantLibcPINVOKE.Schedule_startDate(swigCPtr), false);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Date endDate() {
    Date ret = new Date(NQuantLibcPINVOKE.Schedule_endDate(swigCPtr), false);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

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

  public Period tenor() {
    Period ret = new Period(NQuantLibcPINVOKE.Schedule_tenor(swigCPtr), false);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public BusinessDayConvention businessDayConvention() {
    BusinessDayConvention ret = (BusinessDayConvention)NQuantLibcPINVOKE.Schedule_businessDayConvention(swigCPtr);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

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

  public BusinessDayConvention terminationDateBusinessDayConvention() {
    BusinessDayConvention ret = (BusinessDayConvention)NQuantLibcPINVOKE.Schedule_terminationDateBusinessDayConvention(swigCPtr);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

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

  public DateGeneration.Rule rule() {
    DateGeneration.Rule ret = (DateGeneration.Rule)NQuantLibcPINVOKE.Schedule_rule(swigCPtr);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

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

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

  public Schedule until(Date truncationDate) {
    Schedule ret = new Schedule(NQuantLibcPINVOKE.Schedule_until(swigCPtr, Date.getCPtr(truncationDate)), true);
    if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
