content: package br.com.alevhvm.adotai.administrador.model;
  
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.List;
  
  import br.com.alevhvm.adotai.auth.enums.Roles;
  import br.com.alevhvm.adotai.common.model.PerfilBase;
  import org.springframework.security.core.GrantedAuthority;
  import org.springframework.security.core.authority.SimpleGrantedAuthority;
  import org.springframework.security.core.userdetails.UserDetails;
  
  import jakarta.persistence.Column;
  import jakarta.persistence.Entity;
  import jakarta.persistence.GeneratedValue;
  import jakarta.persistence.GenerationType;
  import jakarta.persistence.Id;
  import jakarta.persistence.Table;
  import lombok.EqualsAndHashCode;
  import lombok.Getter;
  import lombok.NoArgsConstructor;
  import lombok.Setter;
  
  @Getter
  @Setter
  @NoArgsConstructor
  @EqualsAndHashCode(callSuper = false)
  @Entity
  @Table(name = "administrador")
  public class Administrador extends PerfilBase implements UserDetails {
  
      @Id
      @Column(name = "id", nullable = false, unique = true)
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long idAdministrador;
  
      @Override
      public Collection<? extends GrantedAuthority> getAuthorities() {
          Collection<SimpleGrantedAuthority> grants = new ArrayList<>(List.of(
                  new SimpleGrantedAuthority("ROLE_USER"),
                  new SimpleGrantedAuthority("ROLE_ONG"),
                  new SimpleGrantedAuthority("ROLE_ADMIN")));
          if (getRole() == Roles.ADMINMASTER) {
              grants.add(new SimpleGrantedAuthority("ROLE_ADMINMASTER"));
          }
          return grants;
      }
  
      @Override
      public String getPassword() {
          return this.getSenha();
      }
  
      @Override
      public String getUsername() {
          return this.getEmail();
      }
  
  }
  