package com.genlot.ninglottery.toolkit;

import com.genlot.nativesdk.SystemNI;
import com.genlot.nativesdk.model.GameCashTicket;
import com.genlot.nativesdk.model.GameTicket;
import com.genlot.ninglottery.game.GameManager;
import com.genlot.ninglottery.model.GameIDSet;
import com.genlot.ninglottery.model.PlayTypeID;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * @author ZhuYongKang
 * @description 培训模式帮助类
 * @date 2019/11/1
 */
public class TrainMode {

    private static long sn = 0;

    public static Long getIssue() {
        SimpleDateFormat sdr = new SimpleDateFormat("yyyyMMdd", Locale.CHINA);
        Date date = new Date(System.currentTimeMillis());
        String issue = sdr.format(date);
        return Long.parseLong(issue);
    }

    public static Long getSN() {
        return sn++;
    }

    public static GameCashTicket getCashTicket() {
        GameCashTicket ticket = new GameCashTicket();
        ticket.mTerminalID = SystemNI.getTerminalID();
        ticket.mCashIssue = getIssue();
        ticket.mGameID = GameIDSet.GAME_ID_SSQ;
        ticket.mTicketSN = 6;
        ticket.mPrizeMoney = 10000.00;
        ticket.mTaxMoney = 600.00;
        ticket.mBettingTime = System.currentTimeMillis() / 1000;
        ticket.mStatus = 3;
        ticket.mCashTime = 0;
        ticket.mCashTermID = SystemNI.getTerminalID();
        ticket.mCashEndTime = System.currentTimeMillis() / 1000;
        ticket.mTicketMoney = 10.00;
        ticket.mTotalCount = 3;
        ticket.mBetSN[0] = 1;
        ticket.mDrawSN[0] = 1;
        ticket.mWinLevelName[0] = "一等奖";
        ticket.mWinLevelCount[0] = 1;
        ticket.mPrizeBet[0] = 6000.00;
        ticket.mMultiTimes[0] = 1;
        ticket.mTaxBet[0] = 60.00;

        ticket.mBetSN[1] = 2;
        ticket.mDrawSN[1] = 2;
        ticket.mWinLevelName[1] = "二等奖";
        ticket.mWinLevelCount[1] = 1;
        ticket.mPrizeBet[1] = 3000.00;
        ticket.mMultiTimes[1] = 1;
        ticket.mTaxBet[1] = 30.00;

        ticket.mBetSN[2] = 3;
        ticket.mDrawSN[2] = 3;
        ticket.mWinLevelName[2] = "三等奖";
        ticket.mWinLevelCount[2] = 2;
        ticket.mPrizeBet[2] = 1000.00;
        ticket.mMultiTimes[2] = 1;
        ticket.mTaxBet[2] = 10.00;
        return ticket;
    }

    public static GameTicket getGameTicket() {
        GameTicket ticket = new GameTicket();
        ticket.mTerminalID = SystemNI.getTerminalID();
        ticket.mGameIssue = getIssue();
        ticket.mGameID = GameIDSet.GAME_ID_SSQ;
        ticket.mTicketSN = 8;
        ticket.mSaleIssue = getIssue();
        ticket.mOperatorID = GameManager.getUser();
        ticket.mBettingMoney = 10.00;
        ticket.mBettingTime = System.currentTimeMillis() / 1000;
        ticket.mValid = 3;
        ticket.mCancelTime = 0;
        ticket.mCancelTermID = SystemNI.getTerminalID();
        ticket.mBets = 5;
        ticket.mMultiIssue = 1;
        for (int i = 0; i < 5; i++) {
            ticket.mBettingMode[i] = 1;
            ticket.mPlayType[i] = PlayTypeID.SSQ_SINGLE;
            ticket.mMultiTimes[i] = 1;
            ticket.gameBetDataString[i] = "1|2|3|4|5|6|-7|";
        }
        return ticket;
    }
}
