package bg.car_wash.entities;

import bg.car_wash.entities.enumerations.UserType;

import javax.persistence.*;
import javax.validation.constraints.Size;
import java.math.BigDecimal;

@Entity
@Table(name = "users")
public class User {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	@Column(name = "full_name", nullable = false)
	@Size(min = 7, max = 65)
	private String fullName;

	@Column(name = "email", nullable = true)
	@Size(min = 7, max = 100)
	private String email;

	@Column(name = "password", nullable = false)
	@Size(min = 4, max = 15)
	private String password;

	@Basic
	private BigDecimal remuneration;

	@Enumerated(EnumType.STRING)
	@Column(name = "user_type")
	private UserType userType;

	public User() {
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getFullName() {
		return fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public BigDecimal getRemuneration() {
		return remuneration;
	}

	public void setRemuneration(BigDecimal remuneration) {
		this.remuneration = remuneration;
	}

	public UserType getUserType() {
		return userType;
	}

	public void setUserType(UserType userType) {
		this.userType = userType;
	}
}

@@ -74,16 +74,141 @@
 serType;
+%0Aimport org.springframework.security.core.GrantedAuthority;%0Aimport org.springframework.security.core.userdetails.UserDetails;
 %0A%0Aimport
@@ -299,16 +299,45 @@
 Decimal;
+%0Aimport java.util.Collection;
 %0A%0A@Entit
@@ -379,16 +379,39 @@
 ss User 
+implements UserDetails 
 %7B%0A%0A%09@Id%0A
@@ -582,16 +582,115 @@
 lName;%0A%0A
+%09@Column(name = %22username%22, nullable = false)%0A%09@Size(min = 3, max = 25)%0A%09private String username;%0A%0A
 %09@Column
@@ -1021,24 +1021,526 @@
 ser() %7B%0A%09%7D%0A%0A
+%09@Override%0A%09public Collection%3C? extends GrantedAuthority%3E getAuthorities() %7B%0A%09%09return null;%0A%09%7D%0A%0A%09public String getPassword() %7B%0A%09%09return this.password;%0A%09%7D%0A%0A%09@Override%0A%09public String getUsername() %7B%0A%09%09return this.username;%0A%09%7D%0A%0A%09@Override%0A%09public boolean isAccountNonExpired() %7B%0A%09%09return false;%0A%09%7D%0A%0A%09@Override%0A%09public boolean isAccountNonLocked() %7B%0A%09%09return false;%0A%09%7D%0A%0A%09@Override%0A%09public boolean isCredentialsNonExpired() %7B%0A%09%09return false;%0A%09%7D%0A%0A%09@Override%0A%09public boolean isEnabled() %7B%0A%09%09return false;%0A%09%7D%0A%0A
 %09public Long
@@ -1739,32 +1739,108 @@
 = fullName;%0A%09%7D%0A%0A
+%09public void setUsername(String username) %7B%0A%09%09this.username = username;%0A%09%7D%0A%0A
 %09public String g
@@ -1905,24 +1905,24 @@
 ng email) %7B%0A
+
 %09%09this.email
@@ -1939,62 +1939,8 @@
 %09%7D%0A%0A
-%09public String getPassword() %7B%0A%09%09return password;%0A%09%7D%0A%0A
 %09pub

update user entity