package com.davos.assessment.user;

public enum UserRole {
  USER,
  PLATFORM_SUPER_ADMIN,

  /**
   * Legacy roles are kept so older databases can still be read before Flyway
   * migrates role values. New authorization uses PLATFORM_SUPER_ADMIN plus
   * project_memberships.
   */
  @Deprecated
  ADMIN,
  @Deprecated
  SUPER_ADMIN,
  @Deprecated
  OPS_ADMIN,
  @Deprecated
  READONLY_ADMIN;

  public boolean isAdminRole() {
    return this == PLATFORM_SUPER_ADMIN || this == ADMIN || this == SUPER_ADMIN || this == OPS_ADMIN || this == READONLY_ADMIN;
  }

  public boolean canOperate() {
    return this == PLATFORM_SUPER_ADMIN || this == ADMIN || this == SUPER_ADMIN || this == OPS_ADMIN;
  }

  public boolean isPlatformSuper() {
    return this == PLATFORM_SUPER_ADMIN || this == SUPER_ADMIN;
  }
}
