// Path: app/src/main/java/dynoapps/exchange_rates/data/CurrencyType.java
// public interface CurrencyType {
//     int NOT_SET = 0;
//     int ALTININ = 1;
//     int ENPARA = 2;
//     int BIGPARA = 3;
//     int TLKUR = 4;
//     int YAPIKREDI = 5;
//     int YAHOO = 6;
//     int PARAGARANTI = 7;
//     int BLOOMBERGHT = 8;
// 
// }
// 
// Path: app/src/main/java/dynoapps/exchange_rates/model/rates/YapıKrediRate.java
// public class YapıKrediRate extends BuySellRate {
//     @Override
//     public void toRateType() {
//         int rateType = UNKNOWN;
//         String plain_type = type.replace("\n", "");
//         plain_type = plain_type.toLowerCase();
//         if (plain_type.equals("usd")) {
//             rateType = USD;
//         } else if (plain_type.equals("eur")) {
//             rateType = EUR;
//         } else if (plain_type.contains("altın")) {
//             rateType = ONS_TRY;
//         } else if (plain_type.contains("parite")) {
//             rateType = EUR_USD;
//         }
//         this.rateType = rateType;
//     }
// 
//     @Override
//     public void setRealValues() {
//         String val = valueSell.replace(" TL", "").replace(",", ".").trim();
//         valueSellReal = Float.valueOf(val);
// 
//         val = valueBuy.replace(" TL", "").replace(",", ".").trim();
//         valueBuyReal = Float.valueOf(val);
//     }
// 
// 
// }


import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import dynoapps.exchange_rates.data.CurrencyType;
import dynoapps.exchange_rates.model.rates.YapıKrediRate;
import io.reactivex.Observable;
                        .timeout(6000)
                        .userAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36")
                        .get();
                Elements elements = doc.select("#currencyResultContent").select("tr");
                ArrayList<YapıKrediRate> rates = new ArrayList<>();
                if (elements != null) {
                    try {
                        for (Element element : elements) {
                            Elements innerElements = element.select("td");
                            YapıKrediRate rate = new YapıKrediRate();
                            if (innerElements.size() > 3) {
                                rate.valueSell = innerElements.get(2).text();
                                rate.valueBuy = innerElements.get(3).text();
                                rate.type = innerElements.get(0).text();
                                rate.toRateType();
                                rate.setRealValues();
                                rates.add(rate);
                            }
                        }
                    } catch (Exception ignored) {

                    }
                }
                return rates;
            }
        });
    }

    @Override
    public int getSourceType() {
// Path: app/src/main/java/dynoapps/exchange_rates/data/CurrencyType.java
// public interface CurrencyType {
//     int NOT_SET = 0;
//     int ALTININ = 1;
//     int ENPARA = 2;
//     int BIGPARA = 3;
//     int TLKUR = 4;
//     int YAPIKREDI = 5;
//     int YAHOO = 6;
//     int PARAGARANTI = 7;
//     int BLOOMBERGHT = 8;
// 
// }
// 
// Path: app/src/main/java/dynoapps/exchange_rates/model/rates/YapıKrediRate.java
// public class YapıKrediRate extends BuySellRate {
//     @Override
//     public void toRateType() {
//         int rateType = UNKNOWN;
//         String plain_type = type.replace("\n", "");
//         plain_type = plain_type.toLowerCase();
//         if (plain_type.equals("usd")) {
//             rateType = USD;
//         } else if (plain_type.equals("eur")) {
//             rateType = EUR;
//         } else if (plain_type.contains("altın")) {
//             rateType = ONS_TRY;
//         } else if (plain_type.contains("parite")) {
//             rateType = EUR_USD;
//         }
//         this.rateType = rateType;
//     }
// 
//     @Override
//     public void setRealValues() {
//         String val = valueSell.replace(" TL", "").replace(",", ".").trim();
//         valueSellReal = Float.valueOf(val);
// 
//         val = valueBuy.replace(" TL", "").replace(",", ".").trim();
//         valueBuyReal = Float.valueOf(val);
//     }
// 
// 
// }


// Path: app/src/main/java/dynoapps/exchange_rates/provider/YapıKrediRateProvider.java
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import dynoapps.exchange_rates.data.CurrencyType;
import dynoapps.exchange_rates.model.rates.YapıKrediRate;
import io.reactivex.Observable;

                        .timeout(6000)
                        .userAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36")
                        .get();
                Elements elements = doc.select("#currencyResultContent").select("tr");
                ArrayList<YapıKrediRate> rates = new ArrayList<>();
                if (elements != null) {
                    try {
                        for (Element element : elements) {
                            Elements innerElements = element.select("td");
                            YapıKrediRate rate = new YapıKrediRate();
                            if (innerElements.size() > 3) {
                                rate.valueSell = innerElements.get(2).text();
                                rate.valueBuy = innerElements.get(3).text();
                                rate.type = innerElements.get(0).text();
                                rate.toRateType();
                                rate.setRealValues();
                                rates.add(rate);
                            }
                        }
                    } catch (Exception ignored) {

                    }
                }
                return rates;
            }
        });
    }

    @Override
    public int getSourceType() {
        return CurrencyType.YAPIKREDI;