content: package com.example.demo.model;
  
  import com.example.demo.constant.UserRole;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.EnumType;
  import javax.persistence.Enumerated;
  import javax.persistence.Table;
  import lombok.AccessLevel;
  import lombok.Builder;
  import lombok.Getter;
  import lombok.NoArgsConstructor;
  import org.springframework.security.crypto.password.PasswordEncoder;
  
  @Table
  @Entity
  @Getter
  @NoArgsConstructor(access = AccessLevel.PROTECTED)
  public class Account extends BaseEntity {
  
      @Column(nullable = false, unique = true)
      private String username;
  
      @Column(nullable = false)
      private String password;
  
      @Column(nullable = false)
      @Enumerated(value = EnumType.STRING)
      private UserRole role;
  
      public void encodePassword(PasswordEncoder passwordEncoder) {
          this.password = passwordEncoder.encode(this.password);
      }
  
      @Builder
      public Account(String username, String password, UserRole role) {
          this.username = username;
          this.password = password;
          this.role = role;
      }
  }