package com.alterdekim.game.repository;

import com.alterdekim.game.entity.PromotionBanner;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface PromotionBannerRepository extends JpaRepository<PromotionBanner, Long> {
    Optional<PromotionBanner> findById(Long id);

    List<PromotionBanner> findAll();

    @Query(value = "SELECT p FROM PromotionBanner p WHERE p.isSelected = true")
    List<PromotionBanner> findSelected();
}