package org.academiadecodigo.enuminatti.helloworldspringmvc;

import org.academiadecodigo.enuminatti.helloworldspringmvc.models.Bootcamp;
import org.academiadecodigo.enuminatti.helloworldspringmvc.models.User;
import org.academiadecodigo.enuminatti.helloworldspringmvc.services.BootcampService;
import org.academiadecodigo.enuminatti.helloworldspringmvc.services.UserService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * MIT License
 * (c) 2017 Ricardo Constantino
 */

public class Initializer implements InitializingBean {

    @Autowired
    private UserService userService;

    @Autowired
    private BootcampService bootcampService;

    @Override
    public void afterPropertiesSet() throws Exception {
        userService.addUser(new User("ricardo", "p@gmail.com", "abc"));
        userService.addUser(new User("jp", "p@gmail.com", "abc"));

        bootcampService.addBootcamp(new Bootcamp(1, "Lisboa", "2017/09/04", "2017/12/07"));
        bootcampService.addBootcamp(new Bootcamp(2, "Fundão", "2017/09/04", "2017/12/07"));
    }
}
