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

package pt.gov.cartaodecidadao;

public class PTEID_Pin extends PTEID_Crypto {
  private long swigCPtr;

  protected PTEID_Pin(long cPtr, boolean cMemoryOwn) {
    super(pteidlibJava_WrapperJNI.PTEID_Pin_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  protected static long getCPtr(PTEID_Pin obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        pteidlibJava_WrapperJNI.delete_PTEID_Pin(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public long getIndex() throws PTEID_Exception {
    return pteidlibJava_WrapperJNI.PTEID_Pin_getIndex(swigCPtr, this);
  }

  public long getType() throws PTEID_Exception {
    return pteidlibJava_WrapperJNI.PTEID_Pin_getType(swigCPtr, this);
  }

  public long getId() throws PTEID_Exception {
    return pteidlibJava_WrapperJNI.PTEID_Pin_getId(swigCPtr, this);
  }

  public long getPinRef() throws PTEID_Exception {
    return pteidlibJava_WrapperJNI.PTEID_Pin_getPinRef(swigCPtr, this);
  }

  public PTEID_PinUsage getUsageCode() throws PTEID_Exception {
    return PTEID_PinUsage.swigToEnum(pteidlibJava_WrapperJNI.PTEID_Pin_getUsageCode(swigCPtr, this));
  }

  public long getFlags() throws PTEID_Exception {
    return pteidlibJava_WrapperJNI.PTEID_Pin_getFlags(swigCPtr, this);
  }

  public String getLabel() throws PTEID_Exception {
    return pteidlibJava_WrapperJNI.PTEID_Pin_getLabel(swigCPtr, this);
  }

  public boolean unlockPin(String pszPuk, String pszNewPin, PTEID_ulwrapper triesLeft) throws PTEID_Exception {
	  long		pRemaining = pteidlibJava_WrapperJNI.new_ulongp();				// get a C++ ptr
	  boolean	retval     = pteidlibJava_WrapperJNI.PTEID_Pin_unlockPin(swigCPtr, this, pszPuk, pszNewPin, pRemaining);
	  
	  triesLeft.m_long = pteidlibJava_WrapperJNI.ulongp_value(pRemaining);
	  pteidlibJava_WrapperJNI.delete_ulongp(pRemaining);
	  return retval;
}

  public PTEID_ByteArray getSignature() throws PTEID_Exception {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_Pin_getSignature(swigCPtr, this), false);
  }

  public int getTriesLeft() throws PTEID_Exception {
    return pteidlibJava_WrapperJNI.PTEID_Pin_getTriesLeft(swigCPtr, this);
  }

  public boolean verifyPin(String csPin, PTEID_ulwrapper ulRemaining, boolean bShowDlg) throws PTEID_Exception {
	  long		pRemaining = pteidlibJava_WrapperJNI.new_ulongp();				// get a C++ ptr
	  boolean	retval     = pteidlibJava_WrapperJNI.PTEID_Pin_verifyPin(swigCPtr, this, csPin, pRemaining, bShowDlg);
	  
	  ulRemaining.m_long = pteidlibJava_WrapperJNI.ulongp_value(pRemaining);
	  pteidlibJava_WrapperJNI.delete_ulongp(pRemaining);
	  return retval;
}

  public boolean changePin(String csPin1, String csPin2, PTEID_ulwrapper ulRemaining, String PinName, boolean bShowDlg) throws PTEID_Exception {
	  long		pRemaining	= pteidlibJava_WrapperJNI.new_ulongp();				// get a C++ ptr
	  boolean	retval		= pteidlibJava_WrapperJNI.PTEID_Pin_changePin(swigCPtr, this, csPin1, csPin2, pRemaining, PinName, bShowDlg);
	  
	  ulRemaining.m_long = pteidlibJava_WrapperJNI.ulongp_value(pRemaining);
	  pteidlibJava_WrapperJNI.delete_ulongp(pRemaining);
	  return retval;
}

  public final static long AUTH_PIN = pteidlibJava_WrapperJNI.PTEID_Pin_AUTH_PIN_get();
  public final static long SIGN_PIN = pteidlibJava_WrapperJNI.PTEID_Pin_SIGN_PIN_get();
  public final static long ADDR_PIN = pteidlibJava_WrapperJNI.PTEID_Pin_ADDR_PIN_get();
}
