package com.alterdekim.game.service;

import com.alterdekim.flash.decompiler.mapper.OutputObjectCallback;
import com.alterdekim.game.entity.Smile;
import com.alterdekim.game.repository.SmileRepository;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class SmileService implements OutputObjectCallback {

    @Autowired
    private SmileRepository repository;

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


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

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