package es.uv.dagarcos.master.service;

import es.uv.dagarcos.master.domain.*;
import es.uv.dagarcos.master.repository.ShardLifecycleEventRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ShardLifecycleService {

    @Autowired
    private ShardLifecycleEventRepository lifecycleRepository;

    public void registerEvent(Shard shard,
                              ShardLifecycleEventType type,
                              String details) {

        ShardLifecycleEvent event = new ShardLifecycleEvent(shard, type, details);

        lifecycleRepository.save(event);
    }
}