// Path: app/src/main/java/dynoapps/exchange_rates/model/rates/BaseRate.java
// public abstract class BaseRate implements IConvertable, IRate {
// 
//     public String type;
// 
//     @RateDef
//     protected int rateType;
// 
//     BaseRate() {
//     }
// 
//     @Override
//     public int getRateType() {
//         return rateType;
//     }
// 
//     public String getFormatted(float val) {
//         return RateUtils.valueToUI(val, rateType);
//     }
// }
// 
// Path: app/src/main/java/dynoapps/exchange_rates/model/rates/YahooRate.java
// public class YahooRate extends AvgRate {
//     @Override
//     public void toRateType() {
//         if (TextUtils.isEmpty(type)) rateType = UNKNOWN;
//         int rateType = UNKNOWN;
//         if (type.contains("USDTRY")) {
//             rateType = USD;
//         } else if (type.contains("EURTRY")) {
//             rateType = EUR;
//         } else if (type.contains("EURUSD")) {
//             rateType = EUR_USD;
//         } else if (type.contains("GC")) {
//             rateType = ONS;
//         }
//         this.rateType = rateType;
//     }
// 
//     @Override
//     public void setRealValues() {
//         if (rateType == UNKNOWN) return;
//         val_real_avg = Float.parseFloat(avg_val);
//     }
// }


import android.text.TextUtils;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import dynoapps.exchange_rates.model.rates.BaseRate;
import dynoapps.exchange_rates.model.rates.YahooRate;
import okhttp3.ResponseBody;
import retrofit2.Converter;
import retrofit2.Retrofit;
package dynoapps.exchange_rates.converters;




/**
 * Created by erdemmac on 24/11/2016.
 */

public class YahooConverter implements Converter<ResponseBody, List<BaseRate>> {

    private static final YahooConverter INSTANCE = new YahooConverter();

    private YahooConverter() {
    }

    /**
     * Sample response body <p> <p> "USDTRY=X",3.4837,"12/9/2016","11:45pm"
     * "EURTRY=X",3.6767,"12/9/2016","10:30pm" </p>
     **/
    @Override
    public List<BaseRate> convert(@NonNull ResponseBody value) throws IOException {

        ArrayList<BaseRate> rates = new ArrayList<>();
        String responseBody = value.string();
        if (!TextUtils.isEmpty(responseBody)) {
            String[] splitsMoney = responseBody.split("\n");
            if (splitsMoney.length > 0) {
                for (String singleSplit : splitsMoney) {
                    String[] splits = singleSplit.split(","); // ysi Type not supported
                    if (splits.length > 2) {
// Path: app/src/main/java/dynoapps/exchange_rates/model/rates/BaseRate.java
// public abstract class BaseRate implements IConvertable, IRate {
// 
//     public String type;
// 
//     @RateDef
//     protected int rateType;
// 
//     BaseRate() {
//     }
// 
//     @Override
//     public int getRateType() {
//         return rateType;
//     }
// 
//     public String getFormatted(float val) {
//         return RateUtils.valueToUI(val, rateType);
//     }
// }
// 
// Path: app/src/main/java/dynoapps/exchange_rates/model/rates/YahooRate.java
// public class YahooRate extends AvgRate {
//     @Override
//     public void toRateType() {
//         if (TextUtils.isEmpty(type)) rateType = UNKNOWN;
//         int rateType = UNKNOWN;
//         if (type.contains("USDTRY")) {
//             rateType = USD;
//         } else if (type.contains("EURTRY")) {
//             rateType = EUR;
//         } else if (type.contains("EURUSD")) {
//             rateType = EUR_USD;
//         } else if (type.contains("GC")) {
//             rateType = ONS;
//         }
//         this.rateType = rateType;
//     }
// 
//     @Override
//     public void setRealValues() {
//         if (rateType == UNKNOWN) return;
//         val_real_avg = Float.parseFloat(avg_val);
//     }
// }


// Path: app/src/main/java/dynoapps/exchange_rates/converters/YahooConverter.java
import android.text.TextUtils;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import dynoapps.exchange_rates.model.rates.BaseRate;
import dynoapps.exchange_rates.model.rates.YahooRate;
import okhttp3.ResponseBody;
import retrofit2.Converter;
import retrofit2.Retrofit;

package dynoapps.exchange_rates.converters;




/**
 * Created by erdemmac on 24/11/2016.
 */

public class YahooConverter implements Converter<ResponseBody, List<BaseRate>> {

    private static final YahooConverter INSTANCE = new YahooConverter();

    private YahooConverter() {
    }

    /**
     * Sample response body <p> <p> "USDTRY=X",3.4837,"12/9/2016","11:45pm"
     * "EURTRY=X",3.6767,"12/9/2016","10:30pm" </p>
     **/
    @Override
    public List<BaseRate> convert(@NonNull ResponseBody value) throws IOException {

        ArrayList<BaseRate> rates = new ArrayList<>();
        String responseBody = value.string();
        if (!TextUtils.isEmpty(responseBody)) {
            String[] splitsMoney = responseBody.split("\n");
            if (splitsMoney.length > 0) {
                for (String singleSplit : splitsMoney) {
                    String[] splits = singleSplit.split(","); // ysi Type not supported
                    if (splits.length > 2) {
                        YahooRate rate = new YahooRate();