package ctbrec.ui.sites.streamate;

import ctbrec.sites.streamate.Streamate;
import ctbrec.ui.sites.AbstractTabProvider;
import ctbrec.ui.tabs.ThumbOverviewTab;
import javafx.scene.Scene;
import javafx.scene.control.Tab;

import java.util.ArrayList;
import java.util.List;

public class StreamateTabProvider extends AbstractTabProvider {
    private ThumbOverviewTab followedTab;

    public StreamateTabProvider(Streamate streamate) {
        super(streamate);
    }

    @Override
    protected List<Tab> getSiteTabs(Scene scene) {
        List<Tab> tabs = new ArrayList<>();
        tabs.add(createTab("Girls", Streamate.NAIAD_URL + "/performers?domain=streamate.com&boostedFilters=&excludedFilters=&useProductScore=false&filters=gender:f;online:true"));
        tabs.add(createTab("Guys", Streamate.NAIAD_URL + "/performers?domain=streamate.com&boostedFilters=&excludedFilters=&useProductScore=false&filters=gender:m;online:true"));
        tabs.add(createTab("Couples", Streamate.NAIAD_URL + "/performers?domain=streamate.com&boostedFilters=&excludedFilters=&useProductScore=false&filters=gender:mf;online:true"));
        tabs.add(createTab("Lesbian", Streamate.NAIAD_URL + "/performers?domain=streamate.com&boostedFilters=&excludedFilters=&useProductScore=false&filters=gender:ff;online:true"));
        tabs.add(createTab("Gay", Streamate.NAIAD_URL + "/performers?domain=streamate.com&boostedFilters=&excludedFilters=&useProductScore=false&filters=gender:mm;online:true"));
        tabs.add(createTab("Groups", Streamate.NAIAD_URL + "/performers?domain=streamate.com&boostedFilters=&excludedFilters=&useProductScore=false&filters=gender:g;online:true"));
        tabs.add(createTab("Trans female", Streamate.NAIAD_URL + "/performers?domain=streamate.com&boostedFilters=&excludedFilters=&useProductScore=false&filters=gender:tm2f;online:true"));
        tabs.add(createTab("Trans male", Streamate.NAIAD_URL + "/performers?domain=streamate.com&boostedFilters=&excludedFilters=&useProductScore=false&filters=gender:tf2m;online:true"));
        tabs.add(createTab("New", Streamate.NAIAD_URL + "/performers?domain=streamate.com&boostedFilters=&excludedFilters=&useProductScore=false&filters=new:true;online:true"));

        followedTab = new StreamateFollowedTab((Streamate) site);
        followedTab.setRecorder(recorder);
        tabs.add(followedTab);

        return tabs;
    }

    @Override
    public Tab getFollowedTab() {
        return followedTab;
    }

    private Tab createTab(String title, String url) {
        var updateService = new StreamateUpdateService((Streamate) site, url);
        var tab = new ThumbOverviewTab(title, updateService, site);
        tab.setRecorder(recorder);
        return tab;
    }
}
