001package com.gigya.android.sdk;
002
003public class Config {
004
005    private String apiKey;
006    private String apiDomain;
007    private String gmid;
008    private String ucid;
009    private int accountCacheTime;
010    private boolean interruptionsEnabled = true;
011    private int sessionVerificationInterval = 0;
012    private Long serverOffset;
013
014    //region UPDATE
015
016    public Config updateWith(String apiKey, String apiDomain) {
017        this.apiKey = apiKey;
018        this.apiDomain = apiDomain;
019        return this;
020    }
021
022    public Config updateWith(String apiKey, String apiDomain, int accountCacheTime, int sessionVerificationInterval) {
023        this.apiKey = apiKey;
024        this.apiDomain = apiDomain;
025        this.accountCacheTime = accountCacheTime;
026        this.sessionVerificationInterval = sessionVerificationInterval;
027        return this;
028    }
029
030    public Config updateWith(Config config) {
031        if (config == null) {
032            return this;
033        }
034        updateWith(
035                config.getApiKey(),
036                config.getApiDomain(),
037                config.getAccountCacheTime(),
038                config.getSessionVerificationInterval()
039        );
040        if (config.getGmid() != null) {
041            this.gmid = config.getGmid();
042        }
043        if (config.getUcid() != null) {
044            this.ucid = config.getUcid();
045        }
046        return this;
047    }
048
049    //endregion
050
051    //region GETTERS & SETTERS
052
053    public String getApiKey() {
054        return apiKey;
055    }
056
057    public void setApiKey(String apiKey) {
058        this.apiKey = apiKey;
059    }
060
061    public String getApiDomain() {
062        return apiDomain;
063    }
064
065    public void setApiDomain(String apiDomain) {
066        this.apiDomain = apiDomain;
067    }
068
069    public String getGmid() {
070        return gmid;
071    }
072
073    public void setGmid(String gmid) {
074        this.gmid = gmid;
075    }
076
077    public String getUcid() {
078        return ucid;
079    }
080
081    public void setUcid(String ucid) {
082        this.ucid = ucid;
083    }
084
085    public int getAccountCacheTime() {
086        return accountCacheTime;
087    }
088
089    public void setAccountCacheTime(int accountCacheTime) {
090        this.accountCacheTime = accountCacheTime;
091    }
092
093    public boolean isInterruptionsEnabled() {
094        return interruptionsEnabled;
095    }
096
097    public void setInterruptionsEnabled(boolean interruptionsEnabled) {
098        this.interruptionsEnabled = interruptionsEnabled;
099    }
100
101    public int getSessionVerificationInterval() {
102        return sessionVerificationInterval;
103    }
104
105    public void setSessionVerificationInterval(int sessionVerificationInterval) {
106        this.sessionVerificationInterval = sessionVerificationInterval;
107    }
108
109    public Long getServerOffset() {
110        return serverOffset;
111    }
112
113    public void setServerOffset(Long serverOffset) {
114        this.serverOffset = serverOffset;
115    }
116
117    //endregion
118}