content: package org.ays.auth.model.entity;
  
  import jakarta.persistence.Column;
  import jakarta.persistence.Entity;
  import jakarta.persistence.EnumType;
  import jakarta.persistence.Enumerated;
  import jakarta.persistence.GeneratedValue;
  import jakarta.persistence.GenerationType;
  import jakarta.persistence.Id;
  import jakarta.persistence.JoinColumn;
  import jakarta.persistence.JoinTable;
  import jakarta.persistence.ManyToMany;
  import jakarta.persistence.OneToOne;
  import jakarta.persistence.Table;
  import lombok.AllArgsConstructor;
  import lombok.Builder;
  import lombok.EqualsAndHashCode;
  import lombok.Getter;
  import lombok.NoArgsConstructor;
  import lombok.Setter;
  import lombok.experimental.SuperBuilder;
  import org.ays.auth.model.enums.AysRoleStatus;
  import org.ays.common.model.entity.BaseEntity;
  import org.ays.institution.model.entity.InstitutionEntity;
  
  import java.util.Set;
  
  /**
   * Entity class representing a role within the application, extending from {@link BaseEntity}.
   * This entity maps to the database table "AYS_ROLE".
   */
  @Entity
  @Getter
  @Setter
  @SuperBuilder
  @NoArgsConstructor
  @AllArgsConstructor
  @EqualsAndHashCode(callSuper = true)
  @Table(name = "AYS_ROLE")
  public class AysRoleEntity extends BaseEntity {
  
      @Id
      @Column(name = "ID")
      @GeneratedValue(strategy = GenerationType.UUID)
      private String id;
  
      @Column(name = "INSTITUTION_ID")
      private String institutionId;
  
      @Column(name = "NAME")
      private String name;
  
      @Enumerated(EnumType.STRING)
      @Column(name = "STATUS")
      @Builder.Default
      private AysRoleStatus status = AysRoleStatus.ACTIVE;
  
      @OneToOne
      @JoinColumn(name = "INSTITUTION_ID", insertable = false, updatable = false)
      private InstitutionEntity institution;
  
      @ManyToMany
      @JoinTable(
              name = "AYS_ROLE_PERMISSION_RELATION",
              joinColumns = @JoinColumn(name = "ROLE_ID"),
              inverseJoinColumns = @JoinColumn(name = "PERMISSION_ID")
      )
      private Set<AysPermissionEntity> permissions;
  
  }
  