package com.genlot.ninglottery.game.qlc.betview;

import android.content.Context;
import android.widget.TextView;

import com.genlot.ninglottery.R;
import com.genlot.ninglottery.event.BetChangeEvent;
import com.genlot.ninglottery.game.bet.BetView;
import com.genlot.ninglottery.game.bet.IBetBean;
import com.genlot.ninglottery.game.qlc.bean.Multi7lc;
import com.genlot.ninglottery.toolkit.LogTool;
import com.genlot.ninglottery.widget.BetTextView;

import org.greenrobot.eventbus.EventBus;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @author ZhuYongKang
 * @description 七乐彩复式投注界面
 * @date 2019/8/26
 */
public class Multi7lcView extends BetView {

    public Multi7lcView(Context context) {
        super(context);
        initData();
    }

    @OnClick(R.id.tv_clear_red)
    public void clear(TextView view) {
        Multi7lc bean = (Multi7lc) mBetList.get(0);
        bean.mRedList.clear();
        mTextBet.clearText();
        EventBus.getDefault().post(new BetChangeEvent(bean));
    }

    @Override
    public void rowChange(int newRow) {
        mCurrentRow = newRow;
    }

    public void refresh() {
        mTextBet.setText(((Multi7lc)mBetList.get(0)).mRedList);
    }

    @Override
    public int getLayoutID() {
        return R.layout.view_7lc_multi;
    }

    @Override
    protected void initData() {
        IBetBean bean = new Multi7lc();
        mBetList.add(bean);
    }

    @Override
    public void clear() {
        mBetList.get(0).clear();
        mTextBet.clearText();
    }

    @Override
    public String[] getBetData() {
        String[] betData = new String[1];
        IBetBean bean = mBetList.get(0);
        betData[0] = bean.toBetString();
        return betData;
    }

    @Override
    public void parseBetData(String[] betData) {
        mBetList.get(0).parseBetData(betData[0]);
        refresh();
    }

    @BindView(R.id.tv_bet_red)
    BetTextView mTextBet;
}
