// Change History:


#ifndef DDP_EXPDEF_H
#define DDP_EXPDEF_H

#include "base/AT_GlobalTypes.h"
#include "DDP_PrintFile.h"

#include <string>
#include <vector>

#include  "ddp/ddp_port.h"
#include  "drs/drs_type.h"

#define NOSORT "NO SORT"

////////////////////////////////////////////////////////
// DDP_ExportDef class
////////////////////////////////////////////////////////
class DDP_ExportDef
{
private:
    DART_AggregationType ActionType;
    DART_SortValue       SortVal;
    std::string UserName;
    std::string UserData;
    
protected:
    virtual const byte * GetDefLabel() const { return (const byte *)"Def"; }

public:
    DDP_ExportDef(DART_AggregationType at = DARTAGG_DISPLAY,
                    DART_SortValue sv = SORTVALUE_NOSORT) : ActionType(at),
                    SortVal(sv)
        {}
    DDP_ExportDef(const DDP_ExportDef & rhs) : ActionType(rhs.ActionType),
        SortVal(rhs.SortVal), UserName(rhs.UserName)
        {}
    virtual ~DDP_ExportDef() {}

    DART_AggregationType GetActionType() const { return ActionType; }
    DART_SortValue GetSortValue() const { return SortVal; }
    uint GetActionText(byte * buf, uint sz) const;
    uint GetSortText(byte * buf, uint sz) const;
    virtual const byte * GetUserDefinedName() const { return UserName.length() ? PORT_c_str(UserName) :
        NULL; }
    virtual const byte * GetUserData() const { return UserData.length() ? PORT_c_str(UserData) :
        NULL; }

    void SetActionType(DART_AggregationType at) { ActionType = at; }
    void SetSortVal(DART_SortValue sv) { SortVal = sv; }
    virtual void SetUserDefinedName(const byte * name) { if(name) UserName = (char *)name;
        else UserName.clear(); }
    virtual void SetUserData(const byte * data) { if(data) UserData = (char *)data;
        else UserData.clear(); }

    virtual bool IsVector() const { return false; }

    virtual DDP_ExportDef * NewCopy(const DDP_ExportDef * rhs) const
        { return new DDP_ExportDef(*rhs); }
    virtual bool IsNull() const { const byte * uname = GetUserDefinedName();
        return (!uname || !*uname); }
        
    virtual bool Dump(DDP_PrintFile * file, const byte * prefix = NULL) const;
};


#endif


 