package de.thpeetz.kontor.comics;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import de.thpeetz.kontor.comics.repository.ArtistRepository;
import de.thpeetz.kontor.comics.repository.ComicRepository;
import de.thpeetz.kontor.comics.repository.ComicWorkRepository;
import de.thpeetz.kontor.comics.repository.IssueRepository;
import de.thpeetz.kontor.comics.repository.PublisherRepository;
import de.thpeetz.kontor.comics.repository.StoryArcRepository;
import de.thpeetz.kontor.comics.repository.TradePaperbackRepository;
import de.thpeetz.kontor.comics.repository.VolumeRepository;
import de.thpeetz.kontor.comics.repository.WorktypeRepository;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component
public class SetupModuleComics implements ApplicationListener<ContextRefreshedEvent> {

    boolean alreadySetup = false;

    @Autowired
    private PublisherRepository publisherRepository;

    @Autowired
    private ArtistRepository artistRepository;

    @Autowired
    private WorktypeRepository worktypeRepository;

    @Autowired
    private ComicRepository comicRepository;

    @Autowired
    private ComicWorkRepository comicWorkRepository;

    @Autowired
    private StoryArcRepository storyArcRepository;

    @Autowired
    private TradePaperbackRepository tradePaperbackRepository;

    @Autowired
    private IssueRepository issueRepository;

    @Autowired
    private VolumeRepository volumeRepository;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        if (alreadySetup) {
            log.info("SetupModuleComics already executed, skipping");
            return;
        }
        log.info("Set up Comics data");
    }
}
