package com.genlot.nativesdk.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Arrays;

public class GameCashTicket implements Parcelable {
    private static final int MAX_WIN_LEVEL_SIZE = 128;
    public int mGameID = 0;//游戏ID
    public long mTerminalID = 0;//终端编号
    public long mIssue = 0;//开奖期号
    public long mTicketSN = 0;//票流水号
    public long mCashTime = 0;//兑奖时间
    public long mCashIssue = 0;//兑奖期号
    public long mCashTermID = 0;//兑奖终端编号
    public long mCashEndTime = 0;//兑奖截止时间
    public long mBettingTime = 0;//投注时间
    public int mStatus = 0;//0－终端注销，1-冲正，2-中心注销，3-有效，4－终端兑奖，5－中心兑奖，6－弃奖
    public double mTicketMoney = 0.00f;//票面金额
    public double mPrizeMoney = 0.00f;//中奖总金额
    public double mTaxMoney = 0.00f;//中奖总税额
    public int mTotalCount = 0;//中奖总数
    public int[] mBetSN = null;//注序号
    public int[] mDrawSN = null;//开奖序号
    public int[] mMultiTimes = null;//中奖倍数
    public int[] mWinLevelCount = null;//中奖注数
    public double[] mPrizeBet = null;//单注中奖金额
    public double[] mTaxBet = null;//单注中奖税额
    public String[] mWinLevelName = null;//中奖奖等
    public String mFeatureCode;//特征码

    public GameCashTicket() {
        mBetSN = new int[MAX_WIN_LEVEL_SIZE];
        mDrawSN = new int[MAX_WIN_LEVEL_SIZE];
        mMultiTimes = new int[MAX_WIN_LEVEL_SIZE];
        mWinLevelCount = new int[MAX_WIN_LEVEL_SIZE];
        mPrizeBet = new double[MAX_WIN_LEVEL_SIZE];
        mTaxBet = new double[MAX_WIN_LEVEL_SIZE];
        mWinLevelName = new String[MAX_WIN_LEVEL_SIZE];
        clearCashTicket();
    }

    public void clearCashTicket() {
        mGameID = 0;
        mTerminalID = 0;
        mIssue = 0;
        mTicketSN = 0;
        mCashTime = 0;
        mCashIssue = 0;
        mCashTermID = 0;
        mCashEndTime = 0;
        mBettingTime = 0;
        mStatus = 0;
        mTicketMoney = 0.00f;
        mPrizeMoney = 0.00f;
        mTaxMoney = 0.00f;
        Arrays.fill(mBetSN, 0);
        Arrays.fill(mDrawSN, 0);
        Arrays.fill(mMultiTimes, 0);
        Arrays.fill(mWinLevelCount, 0);
        Arrays.fill(mPrizeBet, 0);
        Arrays.fill(mTaxBet, 0);
        Arrays.fill(mWinLevelName, "");
        mFeatureCode = "";
    }

    public static final Creator<GameCashTicket> CREATOR = new Creator<GameCashTicket>() {
        @Override
        public GameCashTicket createFromParcel(Parcel source) {
            GameCashTicket ticket = new GameCashTicket();
            ticket.mGameID = source.readInt();
            ticket.mTerminalID = source.readLong();
            ticket.mIssue = source.readLong();
            ticket.mTicketSN = source.readLong();
            ticket.mCashTime = source.readLong();
            ticket.mCashIssue = source.readLong();
            ticket.mCashTermID = source.readLong();
            ticket.mCashEndTime = source.readLong();
            ticket.mBettingTime = source.readLong();
            ticket.mStatus = source.readInt();
            ticket.mTicketMoney = source.readDouble();
            ticket.mPrizeMoney = source.readDouble();
            ticket.mTaxMoney = source.readDouble();
            ticket.mTotalCount = source.readInt();
            source.readIntArray(ticket.mBetSN);
            source.readIntArray(ticket.mDrawSN);
            source.readIntArray(ticket.mMultiTimes);
            source.readIntArray(ticket.mWinLevelCount);
            source.readDoubleArray(ticket.mPrizeBet);
            source.readDoubleArray(ticket.mTaxBet);
            source.readStringArray(ticket.mWinLevelName);
            ticket.mFeatureCode = source.readString();
            return ticket;
        }

        @Override
        public GameCashTicket[] newArray(int size) {
            return new GameCashTicket[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        parcel.writeInt(mGameID);
        parcel.writeLong(mTerminalID);
        parcel.writeLong(mIssue);
        parcel.writeLong(mTicketSN);
        parcel.writeLong(mCashTime);
        parcel.writeLong(mCashIssue);
        parcel.writeLong(mCashTermID);
        parcel.writeLong(mCashEndTime);
        parcel.writeLong(mBettingTime);
        parcel.writeInt(mStatus);
        parcel.writeDouble(mTicketMoney);
        parcel.writeDouble(mPrizeMoney);
        parcel.writeDouble(mTaxMoney);
        parcel.writeInt(mTotalCount);
        parcel.writeIntArray(mBetSN);
        parcel.writeIntArray(mDrawSN);
        parcel.writeIntArray(mMultiTimes);
        parcel.writeIntArray(mWinLevelCount);
        parcel.writeDoubleArray(mPrizeBet);
        parcel.writeDoubleArray(mTaxBet);
        parcel.writeStringArray(mWinLevelName);
        parcel.writeString(mFeatureCode);
    }
}
