package com.team.app.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;

import com.team.app.R;

public class TipsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private final Context context;
    private final String[] desc = {"Hello Friends, in this E-book I will share with you some of my Personal Strategies and Investment mindset that'll help you to decrease your losses and stay in profit.\n\nMaking a match Winning team is not the only skill you need in Fantasy Sports Game/Fantasy Sport.  Many a times it happens that you are making a good team in 50–60% of the matches still you end up in loss.\n\nAlso since the Big World Cup Is On its way, everyone will be putting money Mindlessly in this tournament and most of them will end up losing it.\n\nSo here are some points to get your mindset ready for it : ", "As a Fantasy Player, the biggest mistake you make, is that you try to play each and every match.\n\nAnd as this is a universal fact, you cannot win every single league you play. Even many Experts will have a bad day here and there.\n\nSo you need to get this in mind that Winning every league in Fantasy Sport is almost impossible.\n\nFantasy Cricket is a type of Betting and its 60% luck, where eventually you are betting on a Player making him your Captain.\n\nSure, we can select the most in form player, and go with the venue records and what kind of bowler he will be facing. But at the end, if its his day then only he will play and 30–40% will be effected by team combination which is a pure skill game.", "– Your Total Winning on a Fantasy site is just like a Company's Share performing in Stock Market\n\nIf you plot your Total Winnings on a Graph paper, it will behave exactly like a Stock Market Share.\n\nSometimes it goes up. Sometimes it goes down.\n\nIt goes up when you had a good day It goes down when you had a bad day.\n\nSo You need to avoid these bad days as much as possible.\n\nUsually bad days comes after a Winning streak of 2–3 days.  So when you win continuous for 2–3 days. It is highly recommended to avoid playing for 1–2 days. Not even a 15rs Small League. This is a must. Take rest that day.\n\nEven taking a rest after every good day is a nice strategy.\n\nThis way you will decrease the Negative Impact on your Balance.", "In my 4 Years of Experience, the biggest loss I've faced is whenever i tried to Bet Too much in a match getting over excited.  Never Do that.  Never invest more than 25% of your total balance in a match. Make this your mantra. You can invest less, but never invest more.  So even if you end up losing everything in that match, you will still have rest 75% to cover and win", "We all want to earn money. But people who want to earn fast money end up losing their own. Some People end up Investing everything they have in Grand Leagues because they want to make 1 Lakh from 1000 in one day.\n\nTry to aim for only 40–50% Profit whenever you play In share market people works day and night to get 2–3% profit on their investment.  You should gladly accept any kind of small profit here and consider it a victory.\n\nSo if you are investing ₹1000 in a match and you get a profit of ₹400–500 in that match, you can call it a good day.\n\nDoing this consistently will make you a better fantasy player and will keep your investment in line.", "What are bad matches?  A match where you absolutely have no control over and everything depends on luck.  Such matches usually depends on luck.  Example, a final match of a Women series, where there will be almost 10 default players in everyone's team and result will depend on only final one player.  Chance of facing a loss is high in such matches. So you can avoid them too.  Sometimes Bad Matches can come without giving any warning. So avoiding matches randomly or after winning for 1–2 days will increase your chances of avoiding bad matches.", "People usually wonder what is the best time to invest more to cover your loss or increase your profit.\n\n1) Associate/Local Matches –\n\nIf you have the knowledge and proper news sources then hands down these are the best matches to cover your profit.\n\n2) Last Few League Matches Of A Tournament –\n\nIt usually happens in a tournament like IPL, CPL and specially BPL and PSL, Teams make unexpected changes in their last league matches before playoffs.  They usually rest big players who are selected by 80–90% public.  Even though Fantasy Sports Game announce Lineups before deadline, there is a possibility that\n\n3) Spotting an Impulsive Player –\n\nThis is by far the best match to invest in. In a Bilateral series or a tournament, you need to spot some impulsive inning from a player who is not usually consistent. If that player scores big or take 3–4 wkts in that match then you can invest Big in the very next match by dropping that player. Almost 80% of the time they usually don't give the same performance in the very next and are selected by a majority of public.", "I usually get a lot of questions asking which league to join for maximum profit. However there is no proper answer to this question. You get weak opponents in 3850 and might get a tough opponent in 17rs. There is nothing fixed here.\n\nAlthough it is always a good decision to join Mix of 2–3–4 members leagues. Best combination is to invest 40% in H2H 30% in 3 Member 20% in 4 Members\n\nIf you are taking some kind of small risk in your team then you can increase 3–4 member investment by few percent and decrease H2H.\n\nBut don't increase 4 member investment too much and don't decease H2H investment too much.\n\nNote - And Ideally you should join way before toss and be online during toss. You might get some opponents with missed players if they forget to change.", "Honestly I rarely play GL myself. Specifically those Mega Grand Leagues with 35rs Entry and 10–20 Lakh winning. That is pure Lottery. You can keep trying it on side.\n\nHowever, the most realistic version of GL is mini Grand Leagues with 249–investment, around 45 thousand members and 50k–1Lakh Winning 1st rank. Here you have realistic chances of winning. But the entry fee is quite high too. So make sure only to join these GL with your Small Leagues Profit.\n\nAnd for everyone who cannot afford this, you guys can try 5–10rs Entry and 100–500 members Private Contests.", "Never ever invest more than you can afford to lose. And never ever take loan or steal money to play in Fantasy Sports Game. First you should start earning on your own and then play Fantasy Sports Game.  If you are a student, you can start with Cash Bonuses and by saving your pocket money. But don't lend moneybags from anyone to play Fantasy Sports Game.\n\nIf you are in too much loss, never play to cover your losses. Because wherever we play to cover loses we usually end up losing more. Always play to enjoy the match.\n\nThat is it from our side.\n\nHope this guide will help you in the future with better investment strategy.", "This E-book is not an Investment Advice and I am not telling you how and where to invest your money. Everything mentioned here is just personal opinion. Any kind of losses will be your sole responsibility.\n\nThank You!"};
    public int num = 0;
    private final String[] title = {"Introduction", "First you need to understand this", "Understanding Your Bad Days", "Biggest Reason Of Loss - Investing Too Much In A Match", "Biggest Reason Of Loss - Greedy Mindset", "Avoid Bad Matches", "Best Matches To Invest High", "Which type of Leagues to Join", "What About Grand Leagues?", "Final Words", "Important Note -"};

    public TipsAdapter(Context context2) {
        this.context = context2;
    }

    @NonNull
    @Override
    public TipsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        return new TipsViewHolder(LayoutInflater.from(this.context).inflate(R.layout.faq_list, viewGroup, false));
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        TipsViewHolder tipsViewHolder = (TipsViewHolder) holder;
        tipsViewHolder.qus.setText(this.title[position]);
        tipsViewHolder.ans.setText(this.desc[position]);
        tipsViewHolder.crd.setOnClickListener(view -> {
            if (TipsAdapter.this.num == 0) {
                tipsViewHolder.ans.setVisibility(View.VISIBLE);
                TipsAdapter.this.num = 1;
            } else if (TipsAdapter.this.num == 1) {
                tipsViewHolder.ans.setVisibility(View.GONE);
                TipsAdapter.this.num = 0;
            }
        });
    }

    @Override
    public int getItemCount() {
        return this.title.length;
    }

    public static class TipsViewHolder extends RecyclerView.ViewHolder {
        TextView ans;
        CardView crd;
        TextView qus;

        TipsViewHolder(View view) {
            super(view);
            this.crd = view.findViewById(R.id.crd);
            this.qus = view.findViewById(R.id.qus);
            this.ans = view.findViewById(R.id.ans);
        }
    }
}
