package com.alterdekim.game.service;


import com.alterdekim.game.entity.Postcard;
import com.alterdekim.game.entity.Preloader;
import com.alterdekim.game.repository.PostcardRepository;
import com.alterdekim.game.repository.PreloaderRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@AllArgsConstructor
@Service
public class PreloaderService {
    private final PreloaderRepository repository;

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

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

    public Preloader getPreloaderById(long id) {
        return repository.findById(id).orElse(null);
    }

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

    public void savePreloader(Preloader preloader) {
        repository.save(preloader);
    }
}
