package ru.kirillius.pf.sdn.config;

import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import ru.kirillius.pf.sdn.service.AuthService;

@Component
@RequiredArgsConstructor
public class DataInitializer {

    private final AuthService authService;

    @EventListener(ApplicationReadyEvent.class)
    public void init() {
        authService.createDefaultUserIfAbsent();

    }
}
