package com.alterdekim.game.service;

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

import java.util.List;

@NoArgsConstructor
@Service
public class ROService implements OutputObjectCallback {
    @Autowired
    private ResourceObjectRepository repository;

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

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