package com.alterdekim.game.service;

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

import java.util.Optional;

@Service
public class AchievementService implements OutputObjectCallback {

    @Autowired
    private AchievementRepository repository;

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

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