package com.alterdekim.game.service;


import com.alterdekim.game.entity.Promotion;
import com.alterdekim.game.entity.PromotionBanner;
import com.alterdekim.game.repository.PromotionBannerRepository;
import com.alterdekim.game.repository.PromotionRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@AllArgsConstructor
@Service
public class PromotionService {
    private final PromotionRepository repository;

    public List<Promotion> getSelected() {
        return repository.findSelected();
    }

    public List<Promotion> getAll() {
        return repository.findAll();
    }

    public Promotion getPromotionById(long id) {
        return repository.findById(id).orElse(null);
    }

    public void removeById(long id) {
        repository.deleteById(id);
    }

    public void savePromotion(Promotion promotion) {
        repository.save(promotion);
    }
}
