package org.javacodegeeks.hilla;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import com.github.javafaker.Faker;

@Component
public class CustomerData implements ApplicationRunner {

    private final CustomerRepository customerRepository;

    public CustomerData(CustomerRepository customerRepository) {
        this.customerRepository = customerRepository;
    }

    @Override
    public void run(ApplicationArguments args) {
		

        for (int i = 0; i < 50; i++) {
			Faker faker = new Faker();
            String name = faker.name().fullName();
            String email = faker.internet().emailAddress();
            String mobile = faker.phoneNumber().cellPhone();
            customerRepository.save(new Customer(name, email, mobile));
        }

    }

}
