// AT_GlobalTypes.H

#ifndef AT_GlobalTypes_H
#define AT_GlobalTypes_H

enum DART_AggregationType {
    DARTAGG_DISPLAY,
    DARTAGG_EXCLUDE,
    DARTAGG_GROUPBY,
    DARTAGG_SUM,
    DARTAGG_AVERAGE,
    DARTAGG_COUNT,
    DARTAGG_MKTSHARE,
    DARTAGG_PERCENTBUS,
    DARTAGG_DISPLAYFIRST,
    DARTAGG_DISPLAYLAST
};

//---------------------------------------------------------------

static const char * DART_ActionList[] =
{
	"Display",
	"Exclude",
	"Group By",
	"Sum",
	"Average",
	"Count of",
	"Share",
	"% Business by Group",
	"Display First",
	"Display Last",
	""
};


enum DART_SortValue {
    SORTVALUE_SORTASC = 0,
    SORTVALUE_SORTDESC = 1,
    SORTVALUE_NOSORT = -2
};    

enum DART_ApportionValue {
    DART_APPORTID_NONE = 0,
    DART_APPORTID_FULL = 1,
    DART_APPORTID_EQUAL = 2
};

//---------------------------------------------------------------

static const char * DART_SortList[] =
{
	"Ascending",
	"Descending",
	""
}; 


struct DRS_Formula_Info {
    bool IsMutable;
    bool IsReport;
    bool IsQuantile;
};



static const char* DDP_PARAM_RECCOUNT = "RecordCount";
static const char* DDP_PARAM_SPLITRECCOUNT = "SplitRecordCount";
static const char* DDP_PARAM_TABLERECCOUNT = "TableRecordCount";
static const char* DDP_PARAM_AUTONAMEPREFIX = "AutoNamePrefix";
static const char* DDP_PARAM_SPLITTABLES = "SplitTableFields";
static const char* DDP_PARAM_SORTFIELDS = "SortFields";
static const char* DDP_PARAM_APPENDTABLES = "ExportAppendTable";
static const char* DDP_PARAM_APPENDTABLENAME = "ExportAppendTableName";
static const char* DDP_PARAM_OVERWRITE = "OverwriteExisting";
static const char* DDP_PARAM_PRINTORIENT = "PrintOrientation";
static const char* DDP_PARAM_WRAPTABLES = "WrapTables";
static const char* DDP_PARAM_FORMATEXCEL = "FormatExcel";
static const char* DDP_PARAM_ATTACHDESCR = "AttachDescription";
static const char* DDP_PARAM_SPLITOCCURS = "SplitOccurrences";
static const char* DDP_PARAM_EXPORTTYPE = "ExportType";
static const char* DDP_PARAM_APPORTIONTYPE = "ApportionType";
static const char* DDP_PARAM_TIMESTAMP = "AddTimestamp";
static const char* DDP_PARAM_PATHLIMIT = "PathLengthLimit";
static const char* DDP_PARAM_DEFAULTPATH = "DefaultPath";
static const char* DDP_PARAM_RECTYPE = "RecordTypeLabel";
static const char* DDP_PARAM_GRPDESIG = "GroupDesignator";

static const char* DDP_VALUE_PORTRAIT = "PORTRAIT";
static const char* DDP_VALUE_LANDSCAPE = "LANDSCAPE";

static const char* DDP_VALUE_EXPTYPESTD = "Standard";
static const char* DDP_VALUE_EXPTYPESUMONLY = "SummaryOnly";
static const char* DDP_VALUE_EXPTYPESUMDET = "SummaryDetail";

static const char* LBL_VALUE_EXPTYPESTD = "Standard Enhanced Export";
static const char* LBL_VALUE_EXPTYPESUMONLY = "Summary Only";
static const char* LBL_VALUE_EXPTYPESUMDET = "Summary with Detail";

static const char* DARTLOG_SECTION_EXPORTDESC = "Export Description";

static const char* DART_DLL_ATAPPL = "at_appl.dll";
static const char* DART_DLL_ATDDP = "at_ddp.dll";
static const char* DART_DLL_RETRIEVE = "at_retrieve.dll";	

static const char* ITEMPROP_STATE = "State";
static const char* ITEMPROP_TYPE = "ObjectType";
static const char* ITEMPROP_DEF = "ObjectDef";
static const char* ITEMPROP_LABEL = "Label";
static const char* ITEMPROP_DIMLBLS = "DLbls";
static const char* ITEMPROP_PERIODLBL = "PLbl";
static const char* ITEMPROP_FORMULALBL = "FLbl";

static const char* VECTLABEL_FORMULA = "Measure";
static const char* VECTLABEL_PERIOD = "Period";
static const char* VECTLABEL_VECTID = "Data Type";
static const char* VECTLABEL_VIRTPERIODS = "Virtual Periods";
static const char* DEFAULTLBL_RECTYPE = "Record";

static const char* DART_APPORT_NONE = "No apportioning";
static const char* DART_APPORT_NOTAPP = "No chosen fields allow apportioning";
static const char* DART_APPORT_FULL = "100% apportioning";
static const char* DART_APPORT_EQUAL = "Equal apportioning";

static const char* FIELDLEVEL_SEPARATOR = "|";

//---------------------------------------------------------------------------

enum DART_FieldType {
    FIELD_TYPE_SCALAR = 0,
    FIELD_TYPE_VECTOR = 1
};    


typedef enum { DRS_Connection_AND,
               DRS_Connection_OR,
               DRS_Connection_WOUT,
               DRS_Connection_XOR
             } DRS_Connection;


             //AT inherent types
typedef unsigned int AT_FieldID;
typedef unsigned int DLL_Erc;
typedef unsigned long VectorAddress;
typedef unsigned long DLL_Handle;
typedef DLL_Handle * DLL_HandlePtr;

const unsigned short ERC_none = 0;
const unsigned short ERC_any = (unsigned short) -1;

#define MAX_CAPTION_SIZE        256
#define MAX_CAPTION_SHORT_SIZE  64

#define NAME_ILLEGAL_CHARS "xx!xx`xx[xx]xx.xx$xx*xx\\xx'xx/xx?xx=xx\"xx:xx"
#define ILLEGAL_SEP "xx"

static const char* ILLEGAL_CHAR_STRING = "{}(),:;@!%`[].$*\\'/?=\"";

//---------------------------------------------------------------

struct sortRec {
    DLL_Handle pIndex;
    unsigned int isAscending;
    unsigned int keepUnindexed;
    unsigned int isDuplicate;
};

//---------------------------------------------------------------

struct DRS_Descriptor {
    char Caption[MAX_CAPTION_SIZE];
    char Descr[MAX_CAPTION_SHORT_SIZE];
    char ID[MAX_CAPTION_SHORT_SIZE];
};


#endif
