package bg.car_wash.configurations.database;

import bg.car_wash.areas.user.entity.User;
import bg.car_wash.areas.user.entity.UserType;

import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;

public class UserDefault {

	private List<User> users;

	public UserDefault() {
		this.users = new LinkedList<>();
		this.initUsers();
	}

	public void initUsers() {
		User u1 = new User();
		u1.setEmail("ivan@abv.bg");
		u1.setUsername("ivan");
		u1.setFullName("Ivan Ivanov");
		u1.setPassword("123456");
		u1.setUserType(UserType.ADMIN);
		u1.setRemuneration(new BigDecimal("1000"));
		User u2 = new User();
		u2.setEmail("pesho@abv.bg");
		u2.setUsername("pesho");
		u2.setFullName("Pesho Peshev");
		u2.setPassword("123456");
		u2.setUserType(UserType.DIRECTOR);
		u2.setRemuneration(new BigDecimal("2000"));
		User u3 = new User();
		u3.setEmail("asen@abv.bg");
		u3.setUsername("asen");
		u3.setFullName("Asen Asenov");
		u3.setPassword("123456");
		u3.setUserType(UserType.WORKER);
		u3.setRemuneration(new BigDecimal("600"));
		User u4 = new User();
		u4.setEmail("krum@abv.bg");
		u4.setUsername("krum");
		u4.setFullName("Krum Krumov");
		u4.setPassword("123456");
		u4.setUserType(UserType.PAYMASTER);
		u4.setRemuneration(new BigDecimal("800"));

		this.users.add(u1);
		this.users.add(u2);
		this.users.add(u3);
		this.users.add(u4);
	}

	public List<User> getUsers() {
		return this.users;
	}
}

@@ -128,16 +128,147 @@
 serType;
+%0Aimport bg.car_wash.configurations.user.UserConfiguration;%0Aimport org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 %0A%0Aimport
@@ -371,16 +371,98 @@
 ault %7B%0A%0A
+%09private BCryptPasswordEncoder bCryptPasswordEncoder;%0A%0A%09private String password;%0A%0A
 %09private
@@ -540,16 +540,139 @@
 st%3C%3E();%0A
+%09%09this.bCryptPasswordEncoder = new BCryptPasswordEncoder();%0A%09%09this.password = this.bCryptPasswordEncoder.encode(%22123456%22);%0A
 %09%09this.i
@@ -772,34 +772,8 @@
 %22);%0A
-%09%09u1.setUsername(%22ivan%22);%0A
 %09%09u1
@@ -814,32 +814,37 @@
 setPassword(
-%22123456%22
+this.password
 );%0A%09%09u1.setU
@@ -908,17 +908,173 @@
 mal(
-%221000%22));
+UserConfiguration.ADMIN_REMUNERATION));%0A%09%09u1.setAccountNonExpired(true);%0A%09%09u1.setAccountNonLocked(true);%0A%09%09u1.setCredentialsNonExpired(true);%0A%09%09u1.setEnabled(true);%0A
 %0A%09%09U
@@ -1129,35 +1129,8 @@
 %22);%0A
-%09%09u2.setUsername(%22pesho%22);%0A
 %09%09u2
@@ -1172,32 +1172,37 @@
 setPassword(
-%22123456%22
+this.password
 );%0A%09%09u2.setU
@@ -1269,18 +1269,177 @@
 mal(
-%222000%22)
+UserConfiguration.DIRECTOR_REMUNERATION));%0A%09%09u2.setAccountNonExpired(true);%0A%09%09u2.setAccountNonLocked(true);%0A%09%09u2.setCredentialsNonExpired(true);%0A%09%09u2.setEnabled(true
 );%0A
+%0A
 %09%09Us
@@ -1492,34 +1492,8 @@
 %22);%0A
-%09%09u3.setUsername(%22asen%22);%0A
 %09%09u3
@@ -1534,32 +1534,37 @@
 setPassword(
-%22123456%22
+this.password
 );%0A%09%09u3.setU
@@ -1629,16 +1629,174 @@
 mal(
-%22600%22));
+UserConfiguration.WORKER_REMUNERATION));%0A%09%09u3.setAccountNonExpired(true);%0A%09%09u3.setAccountNonLocked(true);%0A%09%09u3.setCredentialsNonExpired(true);%0A%09%09u3.setEnabled(true);%0A
 %0A%09%09U
@@ -1850,34 +1850,8 @@
 %22);%0A
-%09%09u4.setUsername(%22krum%22);%0A
 %09%09u4
@@ -1896,24 +1896,29 @@
 assword(
-%22123456%22
+this.password
 );%0A%09%09u4.
@@ -1990,14 +1990,174 @@
 mal(
-%22800%22)
+UserConfiguration.PAYMASTER_REMUNERATION));%0A%09%09u4.setAccountNonExpired(true);%0A%09%09u4.setAccountNonLocked(true);%0A%09%09u4.setCredentialsNonExpired(true);%0A%09%09u4.setEnabled(true
 );%0A%0A

create 4 users with roles