/* ----------------------------------------------------------------------------
 * 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.
 * ----------------------------------------------------------------------------- */

namespace be.portugal.eid {

using System;
using System.Runtime.InteropServices;

/// <summary>
/// This class represents a SIS card.
/// To get such an object you have to ask it from the ReaderContext.
/// </summary>
public class PTEID_SISCard : PTEID_MemoryCard {
  private HandleRef swigCPtr;

  internal PTEID_SISCard(IntPtr cPtr, bool cMemoryOwn) : base(pteidlib_dotNetPINVOKE.PTEID_SISCardUpcast(cPtr), cMemoryOwn) {
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(PTEID_SISCard obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~PTEID_SISCard() {
    Dispose();
  }

  public override void Dispose() {
    lock(this) {
      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
        swigCMemOwn = false;
        pteidlib_dotNetPINVOKE.delete_PTEID_SISCard(swigCPtr);
      }
      swigCPtr = new HandleRef(null, IntPtr.Zero);
      GC.SuppressFinalize(this);
      base.Dispose();
    }
  }

  /// <summary> 
  /// Return a document from the card.
  /// </summary>
  /// <remarks>
  /// Throw PTEID_ExDocTypeUnknown exception if the document doesn't exist for this card. 
  /// </remarks>
  public override PTEID_XMLDoc getDocument(PTEID_DocumentType type)
  {
	switch(type)
	{
	case PTEID_DocumentType.PTEID_DOCTYPE_FULL:
		return getFullDoc();
	case PTEID_DocumentType.PTEID_DOCTYPE_ID:
		return getID();
	default:
		throw new PTEID_ExDocTypeUnknown();
	}
}

  /// <summary>Get the full document.</summary>
  public PTEID_SisFullDoc getFullDoc() {
    PTEID_SisFullDoc ret = new PTEID_SisFullDoc(pteidlib_dotNetPINVOKE.PTEID_SISCard_getFullDoc(swigCPtr), false);
    if (pteidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw pteidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  /// <summary>Get the id document.</summary>
  public PTEID_SisId getID()
  {
    PTEID_SisId ret = new PTEID_SisId(pteidlib_dotNetPINVOKE.PTEID_SISCard_getID(swigCPtr), false);
    if (pteidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw pteidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  /// <summary>
  /// Return a raw data from the card.
  /// <remarks>
  /// Throw PTEID_ExFileTypeUnknown exception if the document doesn't exist for this card. 
  /// </remarks>
  public override PTEID_ByteArray getRawData(PTEID_RawDataType type)
  {
    PTEID_ByteArray ret = new PTEID_ByteArray(pteidlib_dotNetPINVOKE.PTEID_SISCard_getRawData(swigCPtr, (int)type), false);
    if (pteidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw pteidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  /// <summary>Get the id RawData.</summary>
  public PTEID_ByteArray getRawData_Id()
  {
    PTEID_ByteArray ret = new PTEID_ByteArray(pteidlib_dotNetPINVOKE.PTEID_SISCard_getRawData_Id(swigCPtr), false);
    if (pteidlib_dotNetPINVOKE.SWIGPendingException.Pending) throw pteidlib_dotNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
