package com.alterdekim.game.service;

import com.alterdekim.flash.decompiler.mapper.OutputObjectCallback;
import com.alterdekim.game.entity.GoodMagic;
import com.alterdekim.game.repository.GoodMagicRepository;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
@NoArgsConstructor
public class GoodMagicService implements OutputObjectCallback {

    @Autowired
    private GoodMagicRepository repository;

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

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