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

package be.portugal.eid;

/******************************************************************************//**
  * This class represents a Portugal EID card.
  * \see PTEID_ReaderContext.getEIDCard()
  *********************************************************************************/
public class PTEID_EIDCard extends PTEID_SmartCard {
  private long swigCPtr;

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

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

  protected void finalize() {
    delete();
  }

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

	/** Return true if the user allowed the application to read the card */
  public static boolean isApplicationAllowed() throws java.lang.Exception {
    return pteidlibJava_WrapperJNI.PTEID_EIDCard_isApplicationAllowed();
  }

	/** Return true if this is a test card */
  public boolean isTestCard() throws java.lang.Exception {
    return pteidlibJava_WrapperJNI.PTEID_EIDCard_isTestCard(swigCPtr, this);
  }

	/** Return true if test cards are allowed */
  public boolean getAllowTestCard() throws java.lang.Exception {
    return pteidlibJava_WrapperJNI.PTEID_EIDCard_getAllowTestCard(swigCPtr, this);
  }

	/** Set the flag to allow test cards */
  public void setAllowTestCard(boolean allow) throws java.lang.Exception {
    pteidlibJava_WrapperJNI.PTEID_EIDCard_setAllowTestCard(swigCPtr, this, allow);
  }

 	/**
	  * Return the status of the data.
	  * (RRN certificate validity)
	  */
  public PTEID_CertifStatus getDataStatus() throws java.lang.Exception {
    return PTEID_CertifStatus.swigToEnum(pteidlibJava_WrapperJNI.PTEID_EIDCard_getDataStatus(swigCPtr, this));
  }

	/**
	 * Return a document from the card.
	 * Throw PTEID_ExDocTypeUnknown exception if the document doesn't exist for this card
	 */
  public PTEID_XMLDoc getDocument(PTEID_DocumentType type) throws java.lang.Exception {
    return new PTEID_XMLDoc(pteidlibJava_WrapperJNI.PTEID_EIDCard_getDocument(swigCPtr, this, type.swigValue()), false);
  }

	/** Get the full document */
  public PTEID_EIdFullDoc getFullDoc() throws java.lang.Exception {
    return new PTEID_EIdFullDoc(pteidlibJava_WrapperJNI.PTEID_EIDCard_getFullDoc(swigCPtr, this), false);
  }

	/** Get the id document */
  public PTEID_EId getID() throws java.lang.Exception {
    return new PTEID_EId(pteidlibJava_WrapperJNI.PTEID_EIDCard_getID(swigCPtr, this), false);
  }

	/** Get the picture document */
  public PTEID_Picture getPicture() throws java.lang.Exception {
    return new PTEID_Picture(pteidlibJava_WrapperJNI.PTEID_EIDCard_getPicture(swigCPtr, this), false);
  }

	/** Get the info document  */
  public PTEID_CardVersionInfo getVersionInfo() throws java.lang.Exception {
    return new PTEID_CardVersionInfo(pteidlibJava_WrapperJNI.PTEID_EIDCard_getVersionInfo(swigCPtr, this), false);
  }

	/** Return certificate by type from the card */
  public PTEID_Certificate getCert(PTEID_CertifType type) throws java.lang.Exception {
    return new PTEID_Certificate(pteidlibJava_WrapperJNI.PTEID_EIDCard_getCert(swigCPtr, this, type.swigValue()), false);
  }

	/** Return the RRN certificate from the card */
  public PTEID_Certificate getRrn() {
    return new PTEID_Certificate(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRrn(swigCPtr, this), false);
  }

	/** Return the root certificate from the card */
  public PTEID_Certificate getRoot() throws java.lang.Exception {
    return new PTEID_Certificate(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRoot(swigCPtr, this), false);
  }

	/** Return the ca certificate from the card */
  public PTEID_Certificate getCA() throws java.lang.Exception {
    return new PTEID_Certificate(pteidlibJava_WrapperJNI.PTEID_EIDCard_getCA(swigCPtr, this), false);
  }

	/** Return the signature certificate from the card */
  public PTEID_Certificate getSignature() throws java.lang.Exception {
    return new PTEID_Certificate(pteidlibJava_WrapperJNI.PTEID_EIDCard_getSignature(swigCPtr, this), false);
  }

	/** Return the authentication certificate from the card */
  public PTEID_Certificate getAuthentication() throws java.lang.Exception {
    return new PTEID_Certificate(pteidlibJava_WrapperJNI.PTEID_EIDCard_getAuthentication(swigCPtr, this), false);
  }

	/**
	 * Return a raw data from the card.
	 * Throw PTEID_ExFileTypeUnknown exception if the document doesn't exist for this card
	 */
  public PTEID_ByteArray getRawData(PTEID_RawDataType type) throws java.lang.Exception {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRawData(swigCPtr, this, type.swigValue()), false);
  }

	/** Get the Id raw data */
  public PTEID_ByteArray getRawData_Id() throws java.lang.Exception {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRawData_Id(swigCPtr, this), false);
  }

	/** Get the IdSig raw data */
  public PTEID_ByteArray getRawData_IdSig() throws java.lang.Exception {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRawData_IdSig(swigCPtr, this), false);
  }

	/** Get the address raw data */
  public PTEID_ByteArray getRawData_Addr() throws java.lang.Exception {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRawData_Addr(swigCPtr, this), false);
  }

	/** Get the AddrSig raw data */
  public PTEID_ByteArray getRawData_AddrSig() throws java.lang.Exception {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRawData_AddrSig(swigCPtr, this), false);
  }

	/** Get the picture raw data */
  public PTEID_ByteArray getRawData_Picture() throws java.lang.Exception {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRawData_Picture(swigCPtr, this), false);
  }

	/** Get the Card Info raw data */
  public PTEID_ByteArray getRawData_CardInfo() throws java.lang.Exception {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRawData_CardInfo(swigCPtr, this), false);
  }

	/** Get the Token Info raw data */
  public PTEID_ByteArray getRawData_TokenInfo() throws java.lang.Exception {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRawData_TokenInfo(swigCPtr, this), false);
  }

	/** Get the Cert RRN raw data */
  public PTEID_ByteArray getRawData_CertRRN() throws java.lang.Exception {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRawData_CertRRN(swigCPtr, this), false);
  }

	/** Get the challenge raw data */
  public PTEID_ByteArray getRawData_Challenge() throws java.lang.Exception {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRawData_Challenge(swigCPtr, this), false);
  }

	/** Get the response raw data */
  public PTEID_ByteArray getRawData_Response() throws java.lang.Exception {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_EIDCard_getRawData_Response(swigCPtr, this), false);
  }

}
