/**********************************************************
 * This file has been automatically created by "typemaker2"
 * from the file "tanmethod.xml".
 * Please do not edit this file, all changes will be lost.
 * Better edit the mentioned source file instead.
 **********************************************************/

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include "./tanmethod_p.h"

#include <gwenhywfar/misc.h>
#include <gwenhywfar/debug.h>

/* code headers */

/* macro functions */
GWEN_LIST_FUNCTIONS(AH_TAN_METHOD, AH_TanMethod)
GWEN_LIST2_FUNCTIONS(AH_TAN_METHOD, AH_TanMethod)
GWEN_INHERIT_FUNCTIONS(AH_TAN_METHOD)


AH_TAN_METHOD *AH_TanMethod_new(void) {
  AH_TAN_METHOD *p_struct;

  GWEN_NEW_OBJECT(AH_TAN_METHOD, p_struct)
  p_struct->_refCount=1;
  GWEN_INHERIT_INIT(AH_TAN_METHOD, p_struct)
  GWEN_LIST_INIT(AH_TAN_METHOD, p_struct)
  /* members */
  p_struct->function=0;
  p_struct->process=0;
  p_struct->methodId=NULL;
  p_struct->methodName=NULL;
  p_struct->zkaTanName=NULL;
  p_struct->zkaTanVersion=NULL;
  p_struct->tanMaxLen=0;
  p_struct->formatId=NULL;
  p_struct->prompt=NULL;
  p_struct->returnMaxLen=0;
  p_struct->maxActiveLists=0;
  p_struct->multiTanAllowed=0;
  p_struct->timeShiftAllowed=0;
  p_struct->tanListMode=0;
  p_struct->stornoAllowed=0;
  p_struct->needSmsAccount=0;
  p_struct->needLocalAccount=0;
  p_struct->needChallengeClass=0;
  p_struct->needChallengeAmount=0;
  p_struct->challengeIsStructured=0;
  p_struct->initMode=0;
  p_struct->needTanMediumId=0;
  p_struct->maxActiveTanMedia=0;
  p_struct->gvVersion=0;
  /* virtual functions */

  return p_struct;
}

void AH_TanMethod_free(AH_TAN_METHOD *p_struct) {
  if (p_struct) {
  assert(p_struct->_refCount);
  if (p_struct->_refCount==1) {
    GWEN_INHERIT_FINI(AH_TAN_METHOD, p_struct)
    GWEN_LIST_FINI(AH_TAN_METHOD, p_struct)
  /* members */
    free(p_struct->methodId); p_struct->methodId=NULL;
    free(p_struct->methodName); p_struct->methodName=NULL;
    free(p_struct->zkaTanName); p_struct->zkaTanName=NULL;
    free(p_struct->zkaTanVersion); p_struct->zkaTanVersion=NULL;
    free(p_struct->formatId); p_struct->formatId=NULL;
    free(p_struct->prompt); p_struct->prompt=NULL;
    p_struct->_refCount=0;
    GWEN_FREE_OBJECT(p_struct);
  }
  else
    p_struct->_refCount--;
  }
}

void AH_TanMethod_Attach(AH_TAN_METHOD *p_struct) {
  assert(p_struct);
  assert(p_struct->_refCount);
  p_struct->_refCount++;
}

AH_TAN_METHOD *AH_TanMethod_dup(const AH_TAN_METHOD *p_src) {
  AH_TAN_METHOD *p_struct;

  assert(p_src);
  p_struct=AH_TanMethod_new();
  /* member "function" */
    p_struct->function=p_src->function;


  /* member "process" */
    p_struct->process=p_src->process;


  /* member "methodId" */
  if (p_struct->methodId) {
    free(p_struct->methodId); p_struct->methodId=NULL;
    p_struct->methodId=NULL;
  }
  if (p_src->methodId) {
    p_struct->methodId=strdup(p_src->methodId);
  }


  /* member "methodName" */
  if (p_struct->methodName) {
    free(p_struct->methodName); p_struct->methodName=NULL;
    p_struct->methodName=NULL;
  }
  if (p_src->methodName) {
    p_struct->methodName=strdup(p_src->methodName);
  }


  /* member "zkaTanName" */
  if (p_struct->zkaTanName) {
    free(p_struct->zkaTanName); p_struct->zkaTanName=NULL;
    p_struct->zkaTanName=NULL;
  }
  if (p_src->zkaTanName) {
    p_struct->zkaTanName=strdup(p_src->zkaTanName);
  }


  /* member "zkaTanVersion" */
  if (p_struct->zkaTanVersion) {
    free(p_struct->zkaTanVersion); p_struct->zkaTanVersion=NULL;
    p_struct->zkaTanVersion=NULL;
  }
  if (p_src->zkaTanVersion) {
    p_struct->zkaTanVersion=strdup(p_src->zkaTanVersion);
  }


  /* member "tanMaxLen" */
    p_struct->tanMaxLen=p_src->tanMaxLen;


  /* member "formatId" */
  if (p_struct->formatId) {
    free(p_struct->formatId); p_struct->formatId=NULL;
    p_struct->formatId=NULL;
  }
  if (p_src->formatId) {
    p_struct->formatId=strdup(p_src->formatId);
  }


  /* member "prompt" */
  if (p_struct->prompt) {
    free(p_struct->prompt); p_struct->prompt=NULL;
    p_struct->prompt=NULL;
  }
  if (p_src->prompt) {
    p_struct->prompt=strdup(p_src->prompt);
  }


  /* member "returnMaxLen" */
    p_struct->returnMaxLen=p_src->returnMaxLen;


  /* member "maxActiveLists" */
    p_struct->maxActiveLists=p_src->maxActiveLists;


  /* member "multiTanAllowed" */
    p_struct->multiTanAllowed=p_src->multiTanAllowed;


  /* member "timeShiftAllowed" */
    p_struct->timeShiftAllowed=p_src->timeShiftAllowed;


  /* member "tanListMode" */
    p_struct->tanListMode=p_src->tanListMode;


  /* member "stornoAllowed" */
    p_struct->stornoAllowed=p_src->stornoAllowed;


  /* member "needSmsAccount" */
    p_struct->needSmsAccount=p_src->needSmsAccount;


  /* member "needLocalAccount" */
    p_struct->needLocalAccount=p_src->needLocalAccount;


  /* member "needChallengeClass" */
    p_struct->needChallengeClass=p_src->needChallengeClass;


  /* member "needChallengeAmount" */
    p_struct->needChallengeAmount=p_src->needChallengeAmount;


  /* member "challengeIsStructured" */
    p_struct->challengeIsStructured=p_src->challengeIsStructured;


  /* member "initMode" */
    p_struct->initMode=p_src->initMode;


  /* member "needTanMediumId" */
    p_struct->needTanMediumId=p_src->needTanMediumId;


  /* member "maxActiveTanMedia" */
    p_struct->maxActiveTanMedia=p_src->maxActiveTanMedia;


  /* member "gvVersion" */
    p_struct->gvVersion=p_src->gvVersion;


  return p_struct;
}

AH_TAN_METHOD *AH_TanMethod_copy(AH_TAN_METHOD *p_struct, const AH_TAN_METHOD *p_src) {
  assert(p_struct);
  assert(p_src);
  /* member "function" */
    p_struct->function=p_src->function;


  /* member "process" */
    p_struct->process=p_src->process;


  /* member "methodId" */
  if (p_struct->methodId) {
    free(p_struct->methodId); p_struct->methodId=NULL;
    p_struct->methodId=NULL;
  }
  if (p_src->methodId) {
    p_struct->methodId=strdup(p_src->methodId);
  }


  /* member "methodName" */
  if (p_struct->methodName) {
    free(p_struct->methodName); p_struct->methodName=NULL;
    p_struct->methodName=NULL;
  }
  if (p_src->methodName) {
    p_struct->methodName=strdup(p_src->methodName);
  }


  /* member "zkaTanName" */
  if (p_struct->zkaTanName) {
    free(p_struct->zkaTanName); p_struct->zkaTanName=NULL;
    p_struct->zkaTanName=NULL;
  }
  if (p_src->zkaTanName) {
    p_struct->zkaTanName=strdup(p_src->zkaTanName);
  }


  /* member "zkaTanVersion" */
  if (p_struct->zkaTanVersion) {
    free(p_struct->zkaTanVersion); p_struct->zkaTanVersion=NULL;
    p_struct->zkaTanVersion=NULL;
  }
  if (p_src->zkaTanVersion) {
    p_struct->zkaTanVersion=strdup(p_src->zkaTanVersion);
  }


  /* member "tanMaxLen" */
    p_struct->tanMaxLen=p_src->tanMaxLen;


  /* member "formatId" */
  if (p_struct->formatId) {
    free(p_struct->formatId); p_struct->formatId=NULL;
    p_struct->formatId=NULL;
  }
  if (p_src->formatId) {
    p_struct->formatId=strdup(p_src->formatId);
  }


  /* member "prompt" */
  if (p_struct->prompt) {
    free(p_struct->prompt); p_struct->prompt=NULL;
    p_struct->prompt=NULL;
  }
  if (p_src->prompt) {
    p_struct->prompt=strdup(p_src->prompt);
  }


  /* member "returnMaxLen" */
    p_struct->returnMaxLen=p_src->returnMaxLen;


  /* member "maxActiveLists" */
    p_struct->maxActiveLists=p_src->maxActiveLists;


  /* member "multiTanAllowed" */
    p_struct->multiTanAllowed=p_src->multiTanAllowed;


  /* member "timeShiftAllowed" */
    p_struct->timeShiftAllowed=p_src->timeShiftAllowed;


  /* member "tanListMode" */
    p_struct->tanListMode=p_src->tanListMode;


  /* member "stornoAllowed" */
    p_struct->stornoAllowed=p_src->stornoAllowed;


  /* member "needSmsAccount" */
    p_struct->needSmsAccount=p_src->needSmsAccount;


  /* member "needLocalAccount" */
    p_struct->needLocalAccount=p_src->needLocalAccount;


  /* member "needChallengeClass" */
    p_struct->needChallengeClass=p_src->needChallengeClass;


  /* member "needChallengeAmount" */
    p_struct->needChallengeAmount=p_src->needChallengeAmount;


  /* member "challengeIsStructured" */
    p_struct->challengeIsStructured=p_src->challengeIsStructured;


  /* member "initMode" */
    p_struct->initMode=p_src->initMode;


  /* member "needTanMediumId" */
    p_struct->needTanMediumId=p_src->needTanMediumId;


  /* member "maxActiveTanMedia" */
    p_struct->maxActiveTanMedia=p_src->maxActiveTanMedia;


  /* member "gvVersion" */
    p_struct->gvVersion=p_src->gvVersion;


  return p_struct;
}

int AH_TanMethod_GetFunction(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->function;
}

int AH_TanMethod_GetProcess(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->process;
}

const char *AH_TanMethod_GetMethodId(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->methodId;
}

const char *AH_TanMethod_GetMethodName(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->methodName;
}

const char *AH_TanMethod_GetZkaTanName(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->zkaTanName;
}

const char *AH_TanMethod_GetZkaTanVersion(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->zkaTanVersion;
}

int AH_TanMethod_GetTanMaxLen(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->tanMaxLen;
}

const char *AH_TanMethod_GetFormatId(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->formatId;
}

const char *AH_TanMethod_GetPrompt(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->prompt;
}

int AH_TanMethod_GetReturnMaxLen(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->returnMaxLen;
}

int AH_TanMethod_GetMaxActiveLists(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->maxActiveLists;
}

int AH_TanMethod_GetMultiTanAllowed(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->multiTanAllowed;
}

int AH_TanMethod_GetTimeShiftAllowed(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->timeShiftAllowed;
}

int AH_TanMethod_GetTanListMode(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->tanListMode;
}

int AH_TanMethod_GetStornoAllowed(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->stornoAllowed;
}

int AH_TanMethod_GetNeedSmsAccount(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->needSmsAccount;
}

int AH_TanMethod_GetNeedLocalAccount(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->needLocalAccount;
}

int AH_TanMethod_GetNeedChallengeClass(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->needChallengeClass;
}

int AH_TanMethod_GetNeedChallengeAmount(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->needChallengeAmount;
}

int AH_TanMethod_GetChallengeIsStructured(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->challengeIsStructured;
}

int AH_TanMethod_GetInitMode(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->initMode;
}

int AH_TanMethod_GetNeedTanMediumId(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->needTanMediumId;
}

int AH_TanMethod_GetMaxActiveTanMedia(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->maxActiveTanMedia;
}

int AH_TanMethod_GetGvVersion(const AH_TAN_METHOD *p_struct){
  assert(p_struct);
  return p_struct->gvVersion;
}

void AH_TanMethod_SetFunction(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->function=p_src;
}

void AH_TanMethod_SetProcess(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->process=p_src;
}

void AH_TanMethod_SetMethodId(AH_TAN_METHOD *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->methodId) {
    free(p_struct->methodId); p_struct->methodId=NULL;
    p_struct->methodId=NULL;
  }
  if (p_src) {
    p_struct->methodId=strdup(p_src);
  }
  else {
    p_struct->methodId=NULL;
  }

}

void AH_TanMethod_SetMethodName(AH_TAN_METHOD *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->methodName) {
    free(p_struct->methodName); p_struct->methodName=NULL;
    p_struct->methodName=NULL;
  }
  if (p_src) {
    p_struct->methodName=strdup(p_src);
  }
  else {
    p_struct->methodName=NULL;
  }

}

void AH_TanMethod_SetZkaTanName(AH_TAN_METHOD *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->zkaTanName) {
    free(p_struct->zkaTanName); p_struct->zkaTanName=NULL;
    p_struct->zkaTanName=NULL;
  }
  if (p_src) {
    p_struct->zkaTanName=strdup(p_src);
  }
  else {
    p_struct->zkaTanName=NULL;
  }

}

void AH_TanMethod_SetZkaTanVersion(AH_TAN_METHOD *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->zkaTanVersion) {
    free(p_struct->zkaTanVersion); p_struct->zkaTanVersion=NULL;
    p_struct->zkaTanVersion=NULL;
  }
  if (p_src) {
    p_struct->zkaTanVersion=strdup(p_src);
  }
  else {
    p_struct->zkaTanVersion=NULL;
  }

}

void AH_TanMethod_SetTanMaxLen(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->tanMaxLen=p_src;
}

void AH_TanMethod_SetFormatId(AH_TAN_METHOD *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->formatId) {
    free(p_struct->formatId); p_struct->formatId=NULL;
    p_struct->formatId=NULL;
  }
  if (p_src) {
    p_struct->formatId=strdup(p_src);
  }
  else {
    p_struct->formatId=NULL;
  }

}

void AH_TanMethod_SetPrompt(AH_TAN_METHOD *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->prompt) {
    free(p_struct->prompt); p_struct->prompt=NULL;
    p_struct->prompt=NULL;
  }
  if (p_src) {
    p_struct->prompt=strdup(p_src);
  }
  else {
    p_struct->prompt=NULL;
  }

}

void AH_TanMethod_SetReturnMaxLen(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->returnMaxLen=p_src;
}

void AH_TanMethod_SetMaxActiveLists(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->maxActiveLists=p_src;
}

void AH_TanMethod_SetMultiTanAllowed(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->multiTanAllowed=p_src;
}

void AH_TanMethod_SetTimeShiftAllowed(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->timeShiftAllowed=p_src;
}

void AH_TanMethod_SetTanListMode(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->tanListMode=p_src;
}

void AH_TanMethod_SetStornoAllowed(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->stornoAllowed=p_src;
}

void AH_TanMethod_SetNeedSmsAccount(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->needSmsAccount=p_src;
}

void AH_TanMethod_SetNeedLocalAccount(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->needLocalAccount=p_src;
}

void AH_TanMethod_SetNeedChallengeClass(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->needChallengeClass=p_src;
}

void AH_TanMethod_SetNeedChallengeAmount(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->needChallengeAmount=p_src;
}

void AH_TanMethod_SetChallengeIsStructured(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->challengeIsStructured=p_src;
}

void AH_TanMethod_SetInitMode(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->initMode=p_src;
}

void AH_TanMethod_SetNeedTanMediumId(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->needTanMediumId=p_src;
}

void AH_TanMethod_SetMaxActiveTanMedia(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->maxActiveTanMedia=p_src;
}

void AH_TanMethod_SetGvVersion(AH_TAN_METHOD *p_struct, int p_src){
  assert(p_struct);
  p_struct->gvVersion=p_src;
}

AH_TAN_METHOD_LIST *AH_TanMethod_List_dup(const AH_TAN_METHOD_LIST *p_src) {
  AH_TAN_METHOD_LIST *p_dest;
  AH_TAN_METHOD *p_elem;

  assert(p_src);
  p_dest=AH_TanMethod_List_new();
  p_elem=AH_TanMethod_List_First(p_src);
  while(p_elem) {
    AH_TAN_METHOD *p_cpy;

    p_cpy=AH_TanMethod_dup(p_elem);
    AH_TanMethod_List_Add(p_cpy, p_dest);
    p_elem=AH_TanMethod_List_Next(p_elem);
  }

  return p_dest;
}

void AH_TanMethod_ReadDb(AH_TAN_METHOD *p_struct, GWEN_DB_NODE *p_db){
  assert(p_struct);
  /* member "function" */
  p_struct->function=GWEN_DB_GetIntValue(p_db, "function", 0, 0);
  /* member "process" */
  p_struct->process=GWEN_DB_GetIntValue(p_db, "process", 0, 0);
  /* member "methodId" */
  if (p_struct->methodId) {
    free(p_struct->methodId); p_struct->methodId=NULL;
    p_struct->methodId=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "methodId", 0, NULL); if (s) p_struct->methodId=strdup(s); }
  /* member "methodName" */
  if (p_struct->methodName) {
    free(p_struct->methodName); p_struct->methodName=NULL;
    p_struct->methodName=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "methodName", 0, NULL); if (s) p_struct->methodName=strdup(s); }
  /* member "zkaTanName" */
  if (p_struct->zkaTanName) {
    free(p_struct->zkaTanName); p_struct->zkaTanName=NULL;
    p_struct->zkaTanName=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "zkaTanName", 0, NULL); if (s) p_struct->zkaTanName=strdup(s); }
  /* member "zkaTanVersion" */
  if (p_struct->zkaTanVersion) {
    free(p_struct->zkaTanVersion); p_struct->zkaTanVersion=NULL;
    p_struct->zkaTanVersion=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "zkaTanVersion", 0, NULL); if (s) p_struct->zkaTanVersion=strdup(s); }
  /* member "tanMaxLen" */
  p_struct->tanMaxLen=GWEN_DB_GetIntValue(p_db, "tanMaxLen", 0, 0);
  /* member "formatId" */
  if (p_struct->formatId) {
    free(p_struct->formatId); p_struct->formatId=NULL;
    p_struct->formatId=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "formatId", 0, NULL); if (s) p_struct->formatId=strdup(s); }
  /* member "prompt" */
  if (p_struct->prompt) {
    free(p_struct->prompt); p_struct->prompt=NULL;
    p_struct->prompt=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "prompt", 0, NULL); if (s) p_struct->prompt=strdup(s); }
  /* member "returnMaxLen" */
  p_struct->returnMaxLen=GWEN_DB_GetIntValue(p_db, "returnMaxLen", 0, 0);
  /* member "maxActiveLists" */
  p_struct->maxActiveLists=GWEN_DB_GetIntValue(p_db, "maxActiveLists", 0, 0);
  /* member "multiTanAllowed" */
  p_struct->multiTanAllowed=GWEN_DB_GetIntValue(p_db, "multiTanAllowed", 0, 0);
  /* member "timeShiftAllowed" */
  p_struct->timeShiftAllowed=GWEN_DB_GetIntValue(p_db, "timeShiftAllowed", 0, 0);
  /* member "tanListMode" */
  p_struct->tanListMode=GWEN_DB_GetIntValue(p_db, "tanListMode", 0, 0);
  /* member "stornoAllowed" */
  p_struct->stornoAllowed=GWEN_DB_GetIntValue(p_db, "stornoAllowed", 0, 0);
  /* member "needSmsAccount" */
  p_struct->needSmsAccount=GWEN_DB_GetIntValue(p_db, "needSmsAccount", 0, 0);
  /* member "needLocalAccount" */
  p_struct->needLocalAccount=GWEN_DB_GetIntValue(p_db, "needLocalAccount", 0, 0);
  /* member "needChallengeClass" */
  p_struct->needChallengeClass=GWEN_DB_GetIntValue(p_db, "needChallengeClass", 0, 0);
  /* member "needChallengeAmount" */
  p_struct->needChallengeAmount=GWEN_DB_GetIntValue(p_db, "needChallengeAmount", 0, 0);
  /* member "challengeIsStructured" */
  p_struct->challengeIsStructured=GWEN_DB_GetIntValue(p_db, "challengeIsStructured", 0, 0);
  /* member "initMode" */
  p_struct->initMode=GWEN_DB_GetIntValue(p_db, "initMode", 0, 0);
  /* member "needTanMediumId" */
  p_struct->needTanMediumId=GWEN_DB_GetIntValue(p_db, "needTanMediumId", 0, 0);
  /* member "maxActiveTanMedia" */
  p_struct->maxActiveTanMedia=GWEN_DB_GetIntValue(p_db, "maxActiveTanMedia", 0, 0);
  /* member "gvVersion" */
  p_struct->gvVersion=GWEN_DB_GetIntValue(p_db, "gvVersion", 0, 0);
}

int AH_TanMethod_WriteDb(const AH_TAN_METHOD *p_struct, GWEN_DB_NODE *p_db) {
  int p_rv;

  assert(p_struct);
  /* member "function" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "function", p_struct->function);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "process" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "process", p_struct->process);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "methodId" */
  if (p_struct->methodId) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "methodId", p_struct->methodId); else { GWEN_DB_DeleteVar(p_db, "methodId"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "methodName" */
  if (p_struct->methodName) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "methodName", p_struct->methodName); else { GWEN_DB_DeleteVar(p_db, "methodName"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "zkaTanName" */
  if (p_struct->zkaTanName) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "zkaTanName", p_struct->zkaTanName); else { GWEN_DB_DeleteVar(p_db, "zkaTanName"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "zkaTanVersion" */
  if (p_struct->zkaTanVersion) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "zkaTanVersion", p_struct->zkaTanVersion); else { GWEN_DB_DeleteVar(p_db, "zkaTanVersion"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "tanMaxLen" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "tanMaxLen", p_struct->tanMaxLen);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "formatId" */
  if (p_struct->formatId) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "formatId", p_struct->formatId); else { GWEN_DB_DeleteVar(p_db, "formatId"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "prompt" */
  if (p_struct->prompt) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "prompt", p_struct->prompt); else { GWEN_DB_DeleteVar(p_db, "prompt"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "returnMaxLen" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "returnMaxLen", p_struct->returnMaxLen);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "maxActiveLists" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "maxActiveLists", p_struct->maxActiveLists);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "multiTanAllowed" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "multiTanAllowed", p_struct->multiTanAllowed);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "timeShiftAllowed" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "timeShiftAllowed", p_struct->timeShiftAllowed);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "tanListMode" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "tanListMode", p_struct->tanListMode);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "stornoAllowed" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "stornoAllowed", p_struct->stornoAllowed);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "needSmsAccount" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "needSmsAccount", p_struct->needSmsAccount);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "needLocalAccount" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "needLocalAccount", p_struct->needLocalAccount);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "needChallengeClass" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "needChallengeClass", p_struct->needChallengeClass);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "needChallengeAmount" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "needChallengeAmount", p_struct->needChallengeAmount);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "challengeIsStructured" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "challengeIsStructured", p_struct->challengeIsStructured);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "initMode" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "initMode", p_struct->initMode);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "needTanMediumId" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "needTanMediumId", p_struct->needTanMediumId);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "maxActiveTanMedia" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "maxActiveTanMedia", p_struct->maxActiveTanMedia);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  /* member "gvVersion" */
  p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "gvVersion", p_struct->gvVersion);
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


  return 0;
}

AH_TAN_METHOD *AH_TanMethod_fromDb(GWEN_DB_NODE *p_db) {
  AH_TAN_METHOD *p_struct;
  p_struct=AH_TanMethod_new();
  AH_TanMethod_ReadDb(p_struct, p_db);
  return p_struct;
}

int AH_TanMethod_toDb(const AH_TAN_METHOD *p_struct, GWEN_DB_NODE *p_db) {
  return AH_TanMethod_WriteDb(p_struct, p_db);
}


/* code headers */

