package com.alterdekim.game.service;

import com.alterdekim.flash.decompiler.mapper.OutputObjectCallback;
import com.alterdekim.game.entity.Background;
import com.alterdekim.game.repository.BackgroundRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class BackgroundService implements OutputObjectCallback {

    @Autowired
    private BackgroundRepository repository;

    public Optional<Background> findById(Long id) {
        return this.repository.findById(id);
    }

    @Override
    public void onOutputObjectReady(Object o) {
        this.repository.save((Background) o);
    }
}
