#ifndef APPCLIENT_CONFIG_H_
#define APPCLIENT_CONFIG_H_
/*---------------------------------------------------------------------------*/
/* appclient_config.h                                                        */
/* copyright (c) innovaphone 2012                                            */
/*                                                                           */
/*---------------------------------------------------------------------------*/

NAMESPACE_BEGIN

#define DISPLAY_ON_IF_CHARGING_NO       0
#define DISPLAY_ON_IF_CHARGING_DIMMED   1
#define DISPLAY_ON_IF_CHARGING_BRIGHT   2

#define AUDIO_API_DEFAULT               0
#define AUDIO_API_JAVA                  1
#define AUDIO_API_OPENSLES              2
#define AUDIO_API_RTP                   3
#define AUDIO_API_SLES_RTP_NOT_COMM     4
#define AUDIO_API_JAVA_NOT_COMM         5
#define AUDIO_API_OPENSLES_NOT_COMM     6
#define AUDIO_API_JAVA_VOICE_CALL       7
#define AUDIO_API_JAVA_MIC_BOOST        8
#define AUDIO_API_OPENSLES_MIC_BOOST    9
#define AUDIO_API_OPENSLES_EC           10
#define AUDIO_API_JAVA_EC               11
#define AUDIO_API_SLES_RTP              12

#define BLUETOOTH_HEADSET_MODE_DEFAULT  0
#define BLUETOOTH_HEADSET_MODE_TOGGLING 1

#define PUSH_NOTIFICATIONS_AUTO         0
#define PUSH_NOTIFICATIONS_ON           1
#define PUSH_NOTIFICATIONS_OFF          2
#define PUSH_NOTIFICATIONS_ACTIVE       3

#define AUDIO_DEVICE_ID_DEFAULT   "Default"
#define AUDIO_DEVICE_ID_HANDSET   "Handset"
#define AUDIO_DEVICE_ID_HANDSFREE "Handsfree"
#define AUDIO_DEVICE_ID_HEADSET   "Headset"

enum DockingMode {
    DOCK_NONE = 0,
    DOCK_LEFT = 1,
    DOCK_RIGHT = 2
};

enum HotkeyType {
    HOTKEY_DIAL = 0,
    HOTKEY_ACCEPT = 1,
    HOTKEY_REJECT = 2,
    HOTKEY_APPLINK0 = 3,
    HOTKEY_APPLINK1 = 4,
    HOTKEY_APPLINK2 = 5
};

#if defined(__cplusplus)

class UClientConfigLocalUlong64
{
public:
    virtual void Init(class IClientConfigLocalUlong64 * item) {};
    virtual void Apply(class IClientConfigLocalUlong64 * item) = 0;
};

class IClientConfigLocalUlong64 : public IClientConfigAdminItem
{
    UClientConfigLocalUlong64 * user;

    void Init() { user->Init(this); }
    void Apply() { user->Apply(this); }
    void ToJson(class json_io & json, word baseObject, char * & tmp) override;
    void FromJson(class json_io & json, word baseObject) override;

public:
    ulong64 value;

    IClientConfigLocalUlong64(class IClientConfigItems * items, UClientConfigLocalUlong64 * user, const char * name, ulong64 init = 0);

    void Set(ulong64 newValue);
};

template <class IClientConfigLocalUlong64Subclass> class UClientConfigLocalUlong64Subclass : public UClientConfigLocalUlong64 {
    void Init(IClientConfigLocalUlong64 * item) { Init(static_cast<IClientConfigLocalUlong64Subclass *>(item)); };
    void Apply(IClientConfigLocalUlong64 * item) { Apply(static_cast<IClientConfigLocalUlong64Subclass *>(item)); };
public:
    virtual void Init(IClientConfigLocalUlong64Subclass * item) {};
    virtual void Apply(IClientConfigLocalUlong64Subclass * item) = 0;
};

class UClientConfigAdminHotkey
{
public:
    virtual void Init(class IClientConfigAdminHotkey * item) {};
    virtual void Apply(class IClientConfigAdminHotkey * item) = 0;
};

class IClientConfigAdminHotkey : public IClientConfigAdminItem
{
    UClientConfigAdminHotkey * user;

    void Init() { user->Init(this); }
    void Apply() { user->Apply(this); }
    void ToJson(class json_io & json, word baseObject, char * & tmp) override;
    void FromJson(class json_io & json, word baseObject) override;

public:
    char * value;
    char * appLink;

    IClientConfigAdminHotkey(class IClientConfigItems * items, UClientConfigAdminHotkey * user, const char * name, const char * init = NULL);
    virtual ~IClientConfigAdminHotkey();

    void Set(const char * newValue, const char * newAppLink);
};

template <class IClientConfigAdminHotkeySubclass> class UClientConfigAdminHotkeySubclass : public UClientConfigAdminHotkey {
    void Init(IClientConfigAdminHotkey * item) { Init(static_cast<IClientConfigAdminHotkeySubclass *>(item)); };
    void Apply(IClientConfigAdminHotkey * item) { Apply(static_cast<IClientConfigAdminHotkeySubclass *>(item)); };
public:
    virtual void Init(IClientConfigAdminHotkeySubclass * item) {};
    virtual void Apply(IClientConfigAdminHotkeySubclass * item) = 0;
};

class ClientConfigLogFlags : public IClientConfigLocalUlong64 {
public:
    ClientConfigLogFlags(IClientConfigItems * items, UClientConfigLocalUlong64Subclass<ClientConfigLogFlags> * user, const char * name, ulong64 init = 0) : IClientConfigLocalUlong64(items, user, name, init) {};
};

class ClientConfigNoHexdump : public IClientConfigAdminBool {
public:
    ClientConfigNoHexdump(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigNoHexdump> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigOrientationAdaptationOff : public IClientConfigAdminBool {
public:
    ClientConfigOrientationAdaptationOff(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigOrientationAdaptationOff> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigDisplayOnIfCharging : public IClientConfigAdminEnum {
public:
    ClientConfigDisplayOnIfCharging(IClientConfigItems * items, UClientConfigAdminEnumSubclass<ClientConfigDisplayOnIfCharging> * user, const char * name, const ClientConfigIdNameItem * map) : IClientConfigAdminEnum(items, user, name, map) {};
    ClientConfigDisplayOnIfCharging(IClientConfigItems * items, UClientConfigAdminEnumSubclass<ClientConfigDisplayOnIfCharging> * user, const char * name, const ClientConfigIdNameItem * map, int init) : IClientConfigAdminEnum(items, user, name, map, init) {};
};

class ClientConfigNoPushAutostart : public IClientConfigAdminBool {
public:
    ClientConfigNoPushAutostart(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigNoPushAutostart> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigAudioApi : public IClientConfigAdminEnum {
public:
    ClientConfigAudioApi(IClientConfigItems * items, UClientConfigAdminEnumSubclass<ClientConfigAudioApi> * user, const char * name, const ClientConfigIdNameItem * map) : IClientConfigAdminEnum(items, user, name, map) {};
    ClientConfigAudioApi(IClientConfigItems * items, UClientConfigAdminEnumSubclass<ClientConfigAudioApi> * user, const char * name, const ClientConfigIdNameItem * map, int init) : IClientConfigAdminEnum(items, user, name, map, init) {};
};

class ClientConfigBluetoothHeadsetMode : public IClientConfigAdminEnum {
public:
    ClientConfigBluetoothHeadsetMode(IClientConfigItems * items, UClientConfigAdminEnumSubclass<ClientConfigBluetoothHeadsetMode> * user, const char * name, const ClientConfigIdNameItem * map) : IClientConfigAdminEnum(items, user, name, map) {};
    ClientConfigBluetoothHeadsetMode(IClientConfigItems * items, UClientConfigAdminEnumSubclass<ClientConfigBluetoothHeadsetMode> * user, const char * name, const ClientConfigIdNameItem * map, int init) : IClientConfigAdminEnum(items, user, name, map, init) {};
};

class ClientConfigRingInHeadset : public IClientConfigAdminBool {
public:
    ClientConfigRingInHeadset(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigRingInHeadset> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigActiveAfterClose : public IClientConfigAdminBool {
public:
    ClientConfigActiveAfterClose(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigActiveAfterClose> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigNoVpnAddresses : public IClientConfigAdminBool {
public:
    ClientConfigNoVpnAddresses(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigNoVpnAddresses> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigShowDesktopNotifications : public IClientConfigAdminBool {
public:
    ClientConfigShowDesktopNotifications(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigShowDesktopNotifications> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigAutostart : public IClientConfigAdminBool {
public:
    ClientConfigAutostart(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigAutostart> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigDocking : public IClientConfigAdminBool {
public:
    ClientConfigDocking(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigDocking> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigAutoOffline : public IClientConfigAdminUnsigned {
public:
    ClientConfigAutoOffline(IClientConfigItems * items, UClientConfigAdminUnsignedSubclass<ClientConfigAutoOffline> * user, const char * name, unsigned init) : IClientConfigAdminUnsigned(items, user, name, init) {};
};

class ClientConfigHotkeyDial : public IClientConfigAdminString {
public:
    ClientConfigHotkeyDial(IClientConfigItems * items, UClientConfigAdminStringSubclass<ClientConfigHotkeyDial> * user, const char * name, const char *init) : IClientConfigAdminString(items, user, name, init) {};
};

class ClientConfigHotkeyAccept : public IClientConfigAdminString {
public:
    ClientConfigHotkeyAccept(IClientConfigItems * items, UClientConfigAdminStringSubclass<ClientConfigHotkeyAccept> * user, const char * name, const char *init) : IClientConfigAdminString(items, user, name, init) {};
};

class ClientConfigHotkeyReject : public IClientConfigAdminString {
public:
    ClientConfigHotkeyReject(IClientConfigItems * items, UClientConfigAdminStringSubclass<ClientConfigHotkeyReject> * user, const char * name, const char *init) : IClientConfigAdminString(items, user, name, init) {};
};

class ClientConfigHotkeyAppLink0 : public IClientConfigAdminHotkey {
public:
    ClientConfigHotkeyAppLink0(IClientConfigItems * items, UClientConfigAdminHotkeySubclass<ClientConfigHotkeyAppLink0> * user, const char * name, const char *init) : IClientConfigAdminHotkey(items, user, name, init) {};
};

class ClientConfigHotkeyAppLink1 : public IClientConfigAdminHotkey {
public:
    ClientConfigHotkeyAppLink1(IClientConfigItems * items, UClientConfigAdminHotkeySubclass<ClientConfigHotkeyAppLink1> * user, const char * name, const char *init) : IClientConfigAdminHotkey(items, user, name, init) {};
};

class ClientConfigHotkeyAppLink2 : public IClientConfigAdminHotkey {
public:
    ClientConfigHotkeyAppLink2(IClientConfigItems * items, UClientConfigAdminHotkeySubclass<ClientConfigHotkeyAppLink2> * user, const char * name, const char *init) : IClientConfigAdminHotkey(items, user, name, init) {};
};

class ClientConfigRecordingUrl : public IClientConfigAdminString {
public:
    ClientConfigRecordingUrl(IClientConfigItems * items, UClientConfigAdminStringSubclass<ClientConfigRecordingUrl> * user, const char * name, const char * init = NULL) : IClientConfigAdminString(items, user, name, init) {};
};

class ClientConfigIsRecordingByDefaultOn : public IClientConfigAdminBool {
public:
    ClientConfigIsRecordingByDefaultOn(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigIsRecordingByDefaultOn> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigRecordExternalOnly : public IClientConfigAdminBool {
public:
    ClientConfigRecordExternalOnly(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigRecordExternalOnly> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigAvoidNativeCallScreen : public IClientConfigAdminBool {
public:
    ClientConfigAvoidNativeCallScreen(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigAvoidNativeCallScreen> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigHideFromNativeCallList : public IClientConfigAdminBool {
public:
    ClientConfigHideFromNativeCallList(IClientConfigItems * items, UClientConfigAdminBoolSubclass<ClientConfigHideFromNativeCallList> * user, const char * name, bool init = false) : IClientConfigAdminBool(items, user, name, init) {};
};

class ClientConfigActiveAfterCloseAsked : public IClientConfigBool {
public:
    ClientConfigActiveAfterCloseAsked(IClientConfigItems * items, UClientConfigBoolSubclass<ClientConfigActiveAfterCloseAsked> * user, const char * name, bool init = false) : IClientConfigBool(items, user, name, init) {};
};

class ClientConfigAddressBookInaccessibleWarned : public IClientConfigBool {
public:
    ClientConfigAddressBookInaccessibleWarned(IClientConfigItems * items, UClientConfigBoolSubclass<ClientConfigAddressBookInaccessibleWarned> * user, const char * name, bool init = false) : IClientConfigBool(items, user, name, init) {};
};

class ClientConfigPhoneAccountEnabled : public IClientConfigBool {
public:
    ClientConfigPhoneAccountEnabled(IClientConfigItems * items, UClientConfigBoolSubclass<ClientConfigPhoneAccountEnabled> * user, const char * name, bool init = false) : IClientConfigBool(items, user, name, init) {};
};

class ClientConfigPushNotifications : public IClientConfigInt {
public:
    ClientConfigPushNotifications(IClientConfigItems * items, UClientConfigIntSubclass<ClientConfigPushNotifications> * user, const char * name, int init = 0) : IClientConfigInt(items, user, name, init) {};
};

class ClientConfigPushPassword : public IClientConfigString {
public:
    ClientConfigPushPassword(IClientConfigItems * items, UClientConfigStringSubclass<ClientConfigPushPassword> * user, const char * name, const char * init = NULL) : IClientConfigString(items, user, name, init) {};
};

class ClientConfigDownloadedBuild : public IClientConfigString {
public:
    ClientConfigDownloadedBuild(IClientConfigItems * items, UClientConfigStringSubclass<ClientConfigDownloadedBuild> * user, const char * name, const char * init = NULL) : IClientConfigString(items, user, name, init) {};
};

class ClientConfigCurrentUserSip : public IClientConfigString {
public:
    ClientConfigCurrentUserSip(IClientConfigItems * items, UClientConfigStringSubclass<ClientConfigCurrentUserSip> * user, const char * name, const char * init = NULL) : IClientConfigString(items, user, name, init) {};
};

class ClientConfigLocalStorage : public IClientConfigKeyValueStore {
public:
    ClientConfigLocalStorage(IClientConfigItems * items, UClientConfigKeyValueStoreSubclass<ClientConfigLocalStorage> * user, const char * name) : IClientConfigKeyValueStore(items, user, name) {};
};

class ClientConfigUser :
    public UClientConfigLocalUlong64Subclass<ClientConfigLogFlags>,
    public UClientConfigAdminBoolSubclass<ClientConfigNoHexdump>,
    public UClientConfigAdminBoolSubclass<ClientConfigOrientationAdaptationOff>,
    public UClientConfigAdminEnumSubclass<ClientConfigDisplayOnIfCharging>,
    public UClientConfigAdminBoolSubclass<ClientConfigNoPushAutostart>,
    public UClientConfigAdminEnumSubclass<ClientConfigAudioApi>,
    public UClientConfigAdminEnumSubclass<ClientConfigBluetoothHeadsetMode>,
    public UClientConfigAdminBoolSubclass<ClientConfigRingInHeadset>,
    public UClientConfigAdminBoolSubclass<ClientConfigActiveAfterClose>,
    public UClientConfigAdminBoolSubclass<ClientConfigNoVpnAddresses>,
    public UClientConfigAdminBoolSubclass<ClientConfigShowDesktopNotifications>,
    public UClientConfigAdminBoolSubclass<ClientConfigAutostart>,
    public UClientConfigAdminBoolSubclass<ClientConfigDocking>,
    public UClientConfigAdminUnsignedSubclass<ClientConfigAutoOffline>,
    public UClientConfigAdminStringSubclass<ClientConfigHotkeyDial>,
    public UClientConfigAdminStringSubclass<ClientConfigHotkeyAccept>,
    public UClientConfigAdminStringSubclass<ClientConfigHotkeyReject>,
    public UClientConfigAdminHotkeySubclass<ClientConfigHotkeyAppLink0>,
    public UClientConfigAdminHotkeySubclass<ClientConfigHotkeyAppLink1>,
    public UClientConfigAdminHotkeySubclass<ClientConfigHotkeyAppLink2>,
    public UClientConfigAdminStringSubclass<ClientConfigRecordingUrl>,
    public UClientConfigAdminBoolSubclass<ClientConfigIsRecordingByDefaultOn>,
    public UClientConfigAdminBoolSubclass<ClientConfigRecordExternalOnly>,
    public UClientConfigAdminBoolSubclass<ClientConfigAvoidNativeCallScreen>,
    public UClientConfigAdminBoolSubclass<ClientConfigHideFromNativeCallList>,
    public UClientConfigBoolSubclass<ClientConfigActiveAfterCloseAsked>,
    public UClientConfigBoolSubclass<ClientConfigAddressBookInaccessibleWarned>,
    public UClientConfigBoolSubclass<ClientConfigPhoneAccountEnabled>,
    public UClientConfigIntSubclass<ClientConfigPushNotifications>,
    public UClientConfigStringSubclass<ClientConfigPushPassword>,
    public UClientConfigStringSubclass<ClientConfigDownloadedBuild>,
    public UClientConfigStringSubclass<ClientConfigCurrentUserSip>,
    public UClientConfigKeyValueStoreSubclass<ClientConfigLocalStorage>
{
};

class ClientConfig
{
public:
    IClientConfigItems items;
    ClientConfigLogFlags logFlags;
    ClientConfigNoHexdump noHexdump;
    ClientConfigOrientationAdaptationOff orientationAdaptationOff;
    ClientConfigDisplayOnIfCharging displayOnIfCharging;
    ClientConfigNoPushAutostart noPushAutostart;
#ifdef __ANDROID__
    ClientConfigAudioApi audioApi;
    ClientConfigBluetoothHeadsetMode bluetoothHeadsetMode;
    ClientConfigPhoneAccountEnabled phoneAccountEnabled;
    ClientConfigAvoidNativeCallScreen avoidNativeCallScreen;
#endif
#ifdef _IOS_
    ClientConfigRingInHeadset ringInHeadset;
    ClientConfigActiveAfterClose activeAfterClose;
    ClientConfigActiveAfterCloseAsked activeAfterCloseAsked;
    ClientConfigAddressBookInaccessibleWarned addressBookInaccessibleWarned;
#endif
    ClientConfigPushNotifications pushNotifications;
    ClientConfigPushPassword pushPassword;
    ClientConfigDownloadedBuild downloadedBuild;
    ClientConfigNoVpnAddresses noVpnAddresses;
    ClientConfigShowDesktopNotifications showDesktopNotifications;
    ClientConfigAutostart autostart;
    ClientConfigDocking docking;
    ClientConfigAutoOffline autoOffline;
    ClientConfigHotkeyDial hotkeyDial;
    ClientConfigHotkeyAccept hotkeyAccept;
    ClientConfigHotkeyReject hotkeyReject;
    ClientConfigHotkeyAppLink0 hotkeyAppLink0;
    ClientConfigHotkeyAppLink1 hotkeyAppLink1;
    ClientConfigHotkeyAppLink2 hotkeyAppLink2;
    ClientConfigRecordingUrl recordingUrl;
    ClientConfigIsRecordingByDefaultOn isRecordingByDefaultOn;
    ClientConfigRecordExternalOnly recordExternalOnly;
    ClientConfigHideFromNativeCallList hideFromNativeCallList;
    ClientConfigCurrentUserSip currentUserSip;
    bool signalingApp;
    ClientConfigLocalStorage localStorage;

    ClientConfig(UClientConfigItems * itemsUser, ClientConfigUser * user);
};

extern ClientConfig * appclientConfig;

#endif
NAMESPACE_END

/*---------------------------------------------------------------------------*/
#endif /* APPCLIENT_CONFIG_H_ */
