package cn.muchinfo.rma.global;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import cn.muchinfo.rma.global.data.AccountData;
import cn.muchinfo.rma.global.data.GoodsInfoAndQuotes;
import cn.muchinfo.rma.global.data.UserAccountData;
import cn.muchinfo.rma.global.data.account.LoginQueryData;
import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo;
import cn.muchinfo.rma.global.data.database.EnumDicEntity;
import cn.muchinfo.rma.global.data.database.ErrorCodeEntity;
import cn.muchinfo.rma.protobuf.protoclasses.SystemMI1;

public class BaseGlobalData {

    /**
     * 服务器时间戳
     */
    private Long timeStamp;

    public Long getTimeStamp() {
        // 返回时间戳计算了本地与服务器之前的差异
        return new Date(new Date().getTime() + timeStamp).getTime();
    }

    public void setTimeStamp(Long timeStamp) {
        this.timeStamp = timeStamp;
    }

    /**
     * 登录返回
     */
    private SystemMI1.LoginRsp loginRsp;

    /**
     * 资金账户信息
     */
    private List<AccountData> accountDataList;

    /***
     * 暂存错误信息
     */
    private List<ErrorCodeEntity> errorCodeEntityList;

    /***
     * 暂存的枚举信息
     */
    private List<EnumDicEntity> enumDicEntityList;

    /**
     * 用户信息
     */
    private UserAccountData userAccountData;

    /**
     * 统一查询
     */
    private LoginQueryData loginQueryData;

    /**
     * 商品信息
     * @return
     */
    private List<GoodsInfo> goodsInfoList;

    /**
     * 包含商品信息和goodscode和盘面信息的实体类
     */
    private ArrayList<GoodsInfoAndQuotes> goodsInfoAndQuotesList;

    public ArrayList<GoodsInfoAndQuotes> getGoodsInfoAndQuotesList() {
        if (goodsInfoAndQuotesList == null){
            goodsInfoAndQuotesList = new ArrayList<>();
        }
        return goodsInfoAndQuotesList;
    }

    public void setGoodsInfoAndQuotesList(ArrayList<GoodsInfoAndQuotes> goodsInfoAndQuotesList) {
        this.goodsInfoAndQuotesList = goodsInfoAndQuotesList;
    }

    public List<GoodsInfo> getGoodsInfoList() {
        return goodsInfoList;
    }

    public void setGoodsInfoList(List<GoodsInfo> goodsInfoList) {
        this.goodsInfoList = goodsInfoList;
    }

    public UserAccountData getUserAccountData() {
        return userAccountData;
    }

    public void setUserAccountData(UserAccountData userAccountData) {
        this.userAccountData = userAccountData;
    }

    public SystemMI1.LoginRsp getLoginRsp() {
        return loginRsp;
    }

    public void setLoginRsp(SystemMI1.LoginRsp loginRsp) {
        this.loginRsp = loginRsp;
    }

    public List<AccountData> getAccountDataList() {
        if (accountDataList == null){
            accountDataList = new ArrayList<>();
        }
        return accountDataList;
    }

    public void setAccountDataList(List<AccountData> accountDataList) {
        this.accountDataList = accountDataList;
    }

    public List<ErrorCodeEntity> getErrorCodeEntityList() {
        if (errorCodeEntityList == null){
            errorCodeEntityList = new ArrayList<>();
        }
        return errorCodeEntityList;
    }

    public void setErrorCodeEntityList(List<ErrorCodeEntity> errorCodeEntityList) {
        this.errorCodeEntityList = errorCodeEntityList;
    }

    public List<EnumDicEntity> getEnumDicEntityList() {
        return enumDicEntityList;
    }

    public void setEnumDicEntityList(List<EnumDicEntity> enumDicEntityList) {
        this.enumDicEntityList = enumDicEntityList;
    }

    public LoginQueryData getLoginQueryData() {
        if (loginQueryData == null) {
            loginQueryData = new LoginQueryData();
        }
        return loginQueryData;
    }

    public void setLoginQueryData(LoginQueryData loginQueryData) {
        this.loginQueryData = loginQueryData;
    }
}
