/**********************************************************
 * This file has been automatically created by "typemaker2"
 * from the file "paymentgroup.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 "./paymentgroup_p.h"

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

/* code headers */

/* macro functions */
GWEN_LIST_FUNCTIONS(AB_IMEXPORTER_XML_PAYMENTGROUP, AB_ImExporterXML_PaymentGroup)


AB_IMEXPORTER_XML_PAYMENTGROUP *AB_ImExporterXML_PaymentGroup_new(void) {
  AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct;

  GWEN_NEW_OBJECT(AB_IMEXPORTER_XML_PAYMENTGROUP, p_struct)
  GWEN_LIST_INIT(AB_IMEXPORTER_XML_PAYMENTGROUP, p_struct)
  /* members */
  p_struct->id=NULL;
  p_struct->transactionCount=0;
  p_struct->controlSum=AB_Value_new();
  p_struct->transactionDate=NULL;
  p_struct->sequence=AB_Transaction_SequenceUnknown;
  p_struct->creditorSchemeId=NULL;
  p_struct->localIban=NULL;
  p_struct->localBic=NULL;
  p_struct->localName=NULL;
  p_struct->transactionList2=AB_Transaction_List2_new();
  p_struct->hash=NULL;
  /* virtual functions */

  return p_struct;
}

void AB_ImExporterXML_PaymentGroup_free(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct) {
  if (p_struct) {
    GWEN_LIST_FINI(AB_IMEXPORTER_XML_PAYMENTGROUP, p_struct)
  /* members */
    free(p_struct->id); p_struct->id=NULL;
    AB_Value_free(p_struct->controlSum);
    GWEN_Date_free(p_struct->transactionDate); p_struct->transactionDate=NULL;
    free(p_struct->creditorSchemeId); p_struct->creditorSchemeId=NULL;
    free(p_struct->localIban); p_struct->localIban=NULL;
    free(p_struct->localBic); p_struct->localBic=NULL;
    free(p_struct->localName); p_struct->localName=NULL;
    AB_Transaction_List2_free(p_struct->transactionList2); p_struct->transactionList2=NULL;
    free(p_struct->hash); p_struct->hash=NULL;
    GWEN_FREE_OBJECT(p_struct);
  }
}

AB_IMEXPORTER_XML_PAYMENTGROUP *AB_ImExporterXML_PaymentGroup_dup(const AB_IMEXPORTER_XML_PAYMENTGROUP *p_src) {
  AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct;

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


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


  /* member "controlSum" */
  if (p_struct->controlSum) {
    AB_Value_free(p_struct->controlSum);
    p_struct->controlSum=NULL;
  }
  if (p_src->controlSum) {
    p_struct->controlSum=AB_Value_dup(p_src->controlSum);
  }


  /* member "transactionDate" */
  if (p_struct->transactionDate) {
    GWEN_Date_free(p_struct->transactionDate); p_struct->transactionDate=NULL;
    p_struct->transactionDate=NULL;
  }
  if (p_src->transactionDate) {
    p_struct->transactionDate=GWEN_Date_dup(p_src->transactionDate);
  }


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


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


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


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


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


  /* member "transactionList2" */
  if (p_struct->transactionList2) {
    AB_Transaction_List2_free(p_struct->transactionList2); p_struct->transactionList2=NULL;
    p_struct->transactionList2=NULL;
  }
  if (p_src->transactionList2) {
    p_struct->transactionList2=AB_Transaction_List2_dup(p_src->transactionList2);
  }


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


  return p_struct;
}

AB_IMEXPORTER_XML_PAYMENTGROUP *AB_ImExporterXML_PaymentGroup_copy(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct, const AB_IMEXPORTER_XML_PAYMENTGROUP *p_src) {
  assert(p_struct);
  assert(p_src);
  /* member "id" */
  if (p_struct->id) {
    free(p_struct->id); p_struct->id=NULL;
    p_struct->id=NULL;
  }
  if (p_src->id) {
    p_struct->id=strdup(p_src->id);
  }


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


  /* member "controlSum" */
  if (p_struct->controlSum) {
    AB_Value_free(p_struct->controlSum);
    p_struct->controlSum=NULL;
  }
  if (p_src->controlSum) {
    p_struct->controlSum=AB_Value_dup(p_src->controlSum);
  }


  /* member "transactionDate" */
  if (p_struct->transactionDate) {
    GWEN_Date_free(p_struct->transactionDate); p_struct->transactionDate=NULL;
    p_struct->transactionDate=NULL;
  }
  if (p_src->transactionDate) {
    p_struct->transactionDate=GWEN_Date_dup(p_src->transactionDate);
  }


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


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


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


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


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


  /* member "transactionList2" */
  if (p_struct->transactionList2) {
    AB_Transaction_List2_free(p_struct->transactionList2); p_struct->transactionList2=NULL;
    p_struct->transactionList2=NULL;
  }
  if (p_src->transactionList2) {
    p_struct->transactionList2=AB_Transaction_List2_dup(p_src->transactionList2);
  }


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


  return p_struct;
}

const char *AB_ImExporterXML_PaymentGroup_GetId(const AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct){
  assert(p_struct);
  return p_struct->id;
}

int AB_ImExporterXML_PaymentGroup_GetTransactionCount(const AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct){
  assert(p_struct);
  return p_struct->transactionCount;
}

const AB_VALUE *AB_ImExporterXML_PaymentGroup_GetControlSum(const AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct){
  assert(p_struct);
  return p_struct->controlSum;
}

const GWEN_DATE *AB_ImExporterXML_PaymentGroup_GetTransactionDate(const AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct){
  assert(p_struct);
  return p_struct->transactionDate;
}

int AB_ImExporterXML_PaymentGroup_GetSequence(const AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct){
  assert(p_struct);
  return p_struct->sequence;
}

const char *AB_ImExporterXML_PaymentGroup_GetCreditorSchemeId(const AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct){
  assert(p_struct);
  return p_struct->creditorSchemeId;
}

const char *AB_ImExporterXML_PaymentGroup_GetLocalIban(const AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct){
  assert(p_struct);
  return p_struct->localIban;
}

const char *AB_ImExporterXML_PaymentGroup_GetLocalBic(const AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct){
  assert(p_struct);
  return p_struct->localBic;
}

const char *AB_ImExporterXML_PaymentGroup_GetLocalName(const AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct){
  assert(p_struct);
  return p_struct->localName;
}

AB_TRANSACTION_LIST2 *AB_ImExporterXML_PaymentGroup_GetTransactionList2(const AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct){
  assert(p_struct);
  return p_struct->transactionList2;
}

const char *AB_ImExporterXML_PaymentGroup_GetHash(const AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct){
  assert(p_struct);
  return p_struct->hash;
}

void AB_ImExporterXML_PaymentGroup_SetId(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->id) {
    free(p_struct->id); p_struct->id=NULL;
    p_struct->id=NULL;
  }
  if (p_src) {
    p_struct->id=strdup(p_src);
  }
  else {
    p_struct->id=NULL;
  }

}

void AB_ImExporterXML_PaymentGroup_SetTransactionCount(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct, int p_src){
  assert(p_struct);
  p_struct->transactionCount=p_src;
}

void AB_ImExporterXML_PaymentGroup_SetControlSum(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct, const AB_VALUE *p_src){
  assert(p_struct);
  if (p_struct->controlSum) {
    AB_Value_free(p_struct->controlSum);
    p_struct->controlSum=NULL;
  }
  if (p_src) {
    p_struct->controlSum=AB_Value_dup(p_src);
  }
  else {
    p_struct->controlSum=NULL;
  }

}

void AB_ImExporterXML_PaymentGroup_SetTransactionDate(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct, const GWEN_DATE *p_src){
  assert(p_struct);
  if (p_struct->transactionDate) {
    GWEN_Date_free(p_struct->transactionDate); p_struct->transactionDate=NULL;
    p_struct->transactionDate=NULL;
  }
  if (p_src) {
    p_struct->transactionDate=GWEN_Date_dup(p_src);
  }
  else {
    p_struct->transactionDate=NULL;
  }

}

void AB_ImExporterXML_PaymentGroup_SetSequence(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct, int p_src){
  assert(p_struct);
  p_struct->sequence=p_src;
}

void AB_ImExporterXML_PaymentGroup_SetCreditorSchemeId(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->creditorSchemeId) {
    free(p_struct->creditorSchemeId); p_struct->creditorSchemeId=NULL;
    p_struct->creditorSchemeId=NULL;
  }
  if (p_src) {
    p_struct->creditorSchemeId=strdup(p_src);
  }
  else {
    p_struct->creditorSchemeId=NULL;
  }

}

void AB_ImExporterXML_PaymentGroup_SetLocalIban(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->localIban) {
    free(p_struct->localIban); p_struct->localIban=NULL;
    p_struct->localIban=NULL;
  }
  if (p_src) {
    p_struct->localIban=strdup(p_src);
  }
  else {
    p_struct->localIban=NULL;
  }

}

void AB_ImExporterXML_PaymentGroup_SetLocalBic(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->localBic) {
    free(p_struct->localBic); p_struct->localBic=NULL;
    p_struct->localBic=NULL;
  }
  if (p_src) {
    p_struct->localBic=strdup(p_src);
  }
  else {
    p_struct->localBic=NULL;
  }

}

void AB_ImExporterXML_PaymentGroup_SetLocalName(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->localName) {
    free(p_struct->localName); p_struct->localName=NULL;
    p_struct->localName=NULL;
  }
  if (p_src) {
    p_struct->localName=strdup(p_src);
  }
  else {
    p_struct->localName=NULL;
  }

}

void AB_ImExporterXML_PaymentGroup_SetTransactionList2(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct, AB_TRANSACTION_LIST2 *p_src){
  assert(p_struct);
  if (p_struct->transactionList2) {
    AB_Transaction_List2_free(p_struct->transactionList2); p_struct->transactionList2=NULL;
    p_struct->transactionList2=NULL;
  }
  p_struct->transactionList2=p_src;
}

void AB_ImExporterXML_PaymentGroup_SetHash(AB_IMEXPORTER_XML_PAYMENTGROUP *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->hash) {
    free(p_struct->hash); p_struct->hash=NULL;
    p_struct->hash=NULL;
  }
  if (p_src) {
    p_struct->hash=strdup(p_src);
  }
  else {
    p_struct->hash=NULL;
  }

}

AB_IMEXPORTER_XML_PAYMENTGROUP_LIST *AB_ImExporterXML_PaymentGroup_List_dup(const AB_IMEXPORTER_XML_PAYMENTGROUP_LIST *p_src) {
  AB_IMEXPORTER_XML_PAYMENTGROUP_LIST *p_dest;
  AB_IMEXPORTER_XML_PAYMENTGROUP *p_elem;

  assert(p_src);
  p_dest=AB_ImExporterXML_PaymentGroup_List_new();
  p_elem=AB_ImExporterXML_PaymentGroup_List_First(p_src);
  while(p_elem) {
    AB_IMEXPORTER_XML_PAYMENTGROUP *p_cpy;

    p_cpy=AB_ImExporterXML_PaymentGroup_dup(p_elem);
    AB_ImExporterXML_PaymentGroup_List_Add(p_cpy, p_dest);
    p_elem=AB_ImExporterXML_PaymentGroup_List_Next(p_elem);
  }

  return p_dest;
}

void AB_ImExporterXML_PaymentGroup_AddTransaction(AB_IMEXPORTER_XML_PAYMENTGROUP *st, AB_TRANSACTION *t) { 
 const AB_VALUE *v; 
 
 assert(st); 
 
 if (st->transactionList2==NULL) 
 st->transactionList2=AB_Transaction_List2_new(); 
 if (st->controlSum==NULL) 
 st->controlSum=AB_Value_new(); 
 
 AB_Transaction_List2_PushBack(st->transactionList2, t); 
 st->transactionCount++; 
 
 v=AB_Transaction_GetValue(t); 
 if (v) { 
 AB_Value_AddValue(st->controlSum, v); 
 } 
 }

/* code headers */

