package hozza.network.models.twitch.repositories;

import hozza.network.models.twitch.result.IStreamerCountry;
import hozza.network.models.twitch.result.IStreamerStat;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import hozza.network.models.twitch.entities.MariaStreamer;

import java.util.List;

public interface MariaStreamerRepository extends JpaRepository<MariaStreamer, Integer>
{
    @Query(value = "SELECT COUNT(*) FROM streamer", nativeQuery = true)
    long getStreamerCount();

    @Query(value = "SELECT COUNT(*) as count, country.name AS country FROM streamer INNER JOIN country ON streamer.country = country.id GROUP BY country.name", nativeQuery = true)
    List<IStreamerCountry> getStreamersCountry();
}
