#include "services/services.h"
#include "core/session.h"
#include "services/anilist.h"
#include "services/kitsu.h"

namespace Services {

void Synchronize() {
	switch (session.config.service) {
		case Anime::Service::AniList: AniList::GetAnimeList(); break;
		case Anime::Service::Kitsu: Kitsu::GetAnimeList(); break;
		default: break;
	}
}

std::vector<int> Search(const std::string& search) {
	switch (session.config.service) {
		case Anime::Service::AniList: return AniList::Search(search);
		case Anime::Service::Kitsu: return Kitsu::Search(search);
		default: return {};
	}
}

std::vector<int> GetSeason(Anime::SeriesSeason season, Date::Year year) {
	switch (session.config.service) {
		case Anime::Service::AniList: return AniList::GetSeason(season, year);
		case Anime::Service::Kitsu: return Kitsu::GetSeason(season, year);
		default: return {};
	}
}

void UpdateAnimeEntry(int id) {
	switch (session.config.service) {
		case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break;
		case Anime::Service::Kitsu: Kitsu::UpdateAnimeEntry(id); break;
		default: break;
	}
}

}; // namespace Services
