package com.airlock.iam.admin.application.configuration;

import com.airlock.iam.admin.domain.model.administrator.permissions.Actions;

public final class RestActionDefinitions {
   private RestActionDefinitions() {
   }

   public static ActionsToRest.RestAction listUsers() {
      return ActionsToRest.RestAction.builder().action(Actions.listUsers).rule(ActionsToRest.Rule.of("GET", "/users/?")).build();
   }

   public static ActionsToRest.RestAction viewUser() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.viewUser)
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+(/(validity|lock|(legacy-)?temporary-lock|roles(/[^/]+)?)+)?/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/authentication-method/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/authentication-method/allowed/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/password/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/statistics/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/remember-me/?"))
         .build();
   }

   public static ActionsToRest.RestAction viewContextData() {
      return ActionsToRest.RestAction.builder().action(Actions.viewContextData).rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/context-data/?")).build();
   }

   public static ActionsToRest.RestAction editUser() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.editUser)
         .rule(ActionsToRest.Rule.of(methods("POST", "PATCH", "DELETE"), "/users/[^/]+(/(context-data|role)/[^/]+/?)"))
         .rule(ActionsToRest.Rule.of("PATCH", "/users/[^/]+/context-data/?"))
         .rule(ActionsToRest.Rule.of(methods("POST", "DELETE"), "/users/[^/]+/validity/(enable|from|until)/?"))
         .rule(ActionsToRest.Rule.of("PATCH", "/users/[^/]+/validity/?"))
         .rule(ActionsToRest.Rule.of(methods("POST", "PUT"), "/users/[^/]+/roles/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/roles/[^/]+/?"))
         .build();
   }

   public static ActionsToRest.RestAction editUsername() {
      return ActionsToRest.RestAction.builder().action(Actions.editUsername).rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/username/change/?")).build();
   }

   public static ActionsToRest.RestAction deleteUser() {
      return ActionsToRest.RestAction.builder().action(Actions.deleteUser).rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/?")).build();
   }

   public static ActionsToRest.RestAction createUser() {
      return ActionsToRest.RestAction.builder().action(Actions.createUser).rule(ActionsToRest.Rule.of("POST", "/users/?")).build();
   }

   public static ActionsToRest.RestAction lockUser() {
      return ActionsToRest.RestAction.builder().action(Actions.lockUser).rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/lock/?")).build();
   }

   public static ActionsToRest.RestAction unlockUser() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.unlockUser)
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/lock/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/password/reset-validity/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/password/reset/attempts/?"))
         .build();
   }

   public static ActionsToRest.RestAction viewUserTrailLog() {
      return ActionsToRest.RestAction.builder().action(Actions.viewUserLogs).rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/logs/usertrail")).build();
   }

   public static ActionsToRest.RestAction orderPassword() {
      return ActionsToRest.RestAction.builder().action(Actions.orderPassword).rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/password/order/?")).build();
   }

   public static ActionsToRest.RestAction unorderPassword() {
      return ActionsToRest.RestAction.builder().action(Actions.unorderPassword).rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/password/order/?")).build();
   }

   public static ActionsToRest.RestAction deletePassword() {
      return ActionsToRest.RestAction.builder().action(Actions.deletePassword).rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/password/?")).build();
   }

   public static ActionsToRest.RestAction generatePassword() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.generatePassword)
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/password/generate/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/password/direct-print/?"))
         .build();
   }

   public static ActionsToRest.RestAction triggerPasswordReset() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.triggerPasswordReset)
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/password/reset/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/password/reset/email/?"))
         .build();
   }

   public static ActionsToRest.RestAction changeAdministratorPassword() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.changeAdministratorPassword)
         .rule(ActionsToRest.Rule.of("POST", "/my/password/change/?"))
         .build();
   }

   public static ActionsToRest.RestAction manageToken() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.manageTokens)
         .rule(ActionsToRest.Rule.of("GET", "/tokens/vasco-(otp|cronto)/license/?"))
         .rule(ActionsToRest.Rule.of("POST", "/tokens/vasco-(cronto|otp)/license/import/?"))
         .build();
   }

   public static ActionsToRest.RestAction viewToken() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.viewToken)
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/secret-questions(/.*)?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/mtan(/.*)?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/mtan/[^/]+/(send-otp|verify-otp)/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/oath/(hotp|totp)(/.*)?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/cronto/(devices|activation-codes)/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/cronto/(devices|activation-codes)/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/generic/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/generic/[^/]+/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/generic/[^/]+/activation-letters/order/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/vasco-otp/devices/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/vasco-otp/devices/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/vasco-otp/devices/[^/]+/activation-letters/order/?"))
         .rule(ActionsToRest.Rule.of("GET", "/tokens/vasco-otp/devices/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/matrix(/.*)?"))
         .rule(ActionsToRest.Rule.of("GET", "/tokens/vasco-otp/devices(/.*)?"))
         .rule(ActionsToRest.Rule.of("GET", "/tokens/vasco-(otp|cronto)/license/?"))
         .rule(ActionsToRest.Rule.of("GET", "/tokens/airlock-2fa/hardware-tokens(/.*)?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/x509/certificates/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/airlock-2fa(/.*)?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/tokens/fido/credentials/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/account-links/?"))
         .build();
   }

   public static ActionsToRest.RestAction editToken() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.editToken)
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/secret-questions/[^/]+/verify/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/secret-questions/[^/]+/lock/?"))
         .rule(ActionsToRest.Rule.of(methods("POST", "PATCH"), "/users/[^/]+/tokens/mtan(/.*)?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/cronto/?"))
         .rule(ActionsToRest.Rule.of("PATCH", "/users/[^/]+/tokens/cronto/activation-codes/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/airlock-2fa/?"))
         .rule(ActionsToRest.Rule.of(methods("POST"), "/users/[^/]+/tokens/oath/(hotp|totp)/?"))
         .rule(ActionsToRest.Rule.of(methods("POST"), "/users/[^/]+/tokens/oath/hotp/[^/]+/increment-counter/?"))
         .rule(ActionsToRest.Rule.of(methods("POST"), "/users/[^/]+/tokens/oath/totp/[^/]+/synchronize/?"))
         .rule(ActionsToRest.Rule.of(methods("POST", "DELETE"), "/users/[^/]+/authentication-method/(activate|migrate)/?"))
         .rule(ActionsToRest.Rule.of(methods("POST", "DELETE"), "/users/[^/]+/authentication-method/activate(/.*)?"))
         .rule(ActionsToRest.Rule.of(methods("POST", "DELETE"), "/users/[^/]+/tokens/cronto/devices/[^/]+/push/?"))
         .rule(ActionsToRest.Rule.of("PATCH", "/tokens/vasco-otp/devices/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("POST", "/tokens/vasco-otp/devices/[^/]+/synchronize/?"))
         .rule(ActionsToRest.Rule.of("PATCH", "/users/[^/]+/tokens/vasco-otp/devices/[^/]+/relationships/(next-device|previous-device)/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/authentication-method/add/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/generic/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("PATCH", "/users/[^/]+/tokens/generic/[^/]+/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/matrix/cards/?"))
         .rule(ActionsToRest.Rule.of("POST", "/bulk-changes/user/token/migration/?"))
         .rule(ActionsToRest.Rule.of("GET", "/bulk-changes/user/token/migration/[^/]+?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/x509/certificates/?"))
         .rule(ActionsToRest.Rule.of("PATCH", "/users/[^/]+/tokens/x509/certificates/[^/]+/?"))
         .rule(ActionsToRest.Rule.of(methods("POST", "DELETE"), "/users/[^/]+/relationships/assigned-vasco-otp-devices/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/relationships/airlock-2fa-hardware-tokens/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/airlock-2fa/hardware-devices/[^/]+/shipment-letters/?"))
         .rule(ActionsToRest.Rule.of("POST", "/tokens/airlock-2fa/hardware-tokens/[^/]+/synchronize/?"))
         .build();
   }

   public static ActionsToRest.RestAction orderNewToken() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.orderNewToken)
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/mtan/iak/order/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/cronto/activation-codes/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/oath/(hotp|totp)/[^/]+/activation-letter/order/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/generic/[^/]+/activation-letters/order/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/vasco-otp/devices/[^/]+/activation-letters/order/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/vasco-otp/devices/[^/]+/activation-letters/send-directly/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/matrix/order/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/airlock-2fa/activation-letter-orders/?"))
         .build();
   }

   public static ActionsToRest.RestAction unorderNewToken() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.unorderNewToken)
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/mtan/iak/order/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/cronto/activation-codes/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/oath/(hotp|totp)/[^/]+/activation-letter/order/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/generic/[^/]+/activation-letters/order/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/vasco-otp/devices/[^/]+/activation-letters/order/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/matrix/order/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/airlock-2fa/activation-letter-orders/[^/]+/?"))
         .build();
   }

   public static ActionsToRest.RestAction deleteToken() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.deleteToken)
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/airlock-2fa/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/airlock-2fa/app-devices/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/airlock-2fa/hardware-devices/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/airlock-2fa/activation-letters/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/oath/(hotp|totp)/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/mtan/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/secret-questions/answers/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/secret-questions/[^/]+/answer/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/cronto/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/cronto/activation-codes/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/cronto/devices/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/generic/[^/]+/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/tokens/vasco-otp/devices/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/remember-me/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/oauth2/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/matrix/cards/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/x509/certificates/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/tokens/airlock-2fa/hardware-tokens/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/fido/credentials/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/account-links/[^/]+/?"))
         .build();
   }

   public static ActionsToRest.RestAction activateToken() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.activateToken)
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/cronto/devices/[^/]+/enable/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/generic/[^/]+/[^/]+/enable/?"))
         .rule(ActionsToRest.Rule.of("POST", "/tokens/vasco-otp/devices/[^/]+/enable/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/matrix/usage/reset-unanswered-challenges/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/secret-questions/enable/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/airlock-2fa/lock/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/fido/credentials/[^/]+/lock/?"))
         .build();
   }

   public static ActionsToRest.RestAction deactivateToken() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.deactivateToken)
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/cronto/devices/[^/]+/enable/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/tokens/generic/[^/]+/[^/]+/enable/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/tokens/vasco-otp/devices/[^/]+/enable/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/secret-questions/enable/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/airlock-2fa/lock/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/fido/credentials/[^/]+/lock/?"))
         .build();
   }

   public static ActionsToRest.RestAction generateTokenIak() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.generateTokenIak)
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/mtan/iak/generate/?"))
         .rule(ActionsToRest.Rule.of("POST", "/users/[^/]+/tokens/airlock-2fa/activation-letters/?"))
         .build();
   }

   public static ActionsToRest.RestAction manageOAuth2Consents() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.manageOAuth2Consents)
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/oauth2/consents/?"))
         .rule(ActionsToRest.Rule.of("GET", "/users/[^/]+/oauth2/consent/authorization-servers/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/users/[^/]+/oauth2/consents/[^/]+/?"))
         .build();
   }

   public static ActionsToRest.RestAction listMaintenanceMessages() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.listMaintenanceMessages)
         .rule(ActionsToRest.Rule.of("GET", "/maintenance-messages/?"))
         .rule(ActionsToRest.Rule.of("GET", "/maintenance-messages/[^/]+/?"))
         .build();
   }

   public static ActionsToRest.RestAction editMaintenanceMessage() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.editMaintenanceMessage)
         .rule(ActionsToRest.Rule.of("POST", "/maintenance-messages/?"))
         .rule(ActionsToRest.Rule.of("PATCH", "/maintenance-messages/[^/]+/?"))
         .build();
   }

   public static ActionsToRest.RestAction deleteMaintenanceMessage() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.deleteMaintenanceMessage)
         .rule(ActionsToRest.Rule.of("DELETE", "/maintenance-messages/[^/]+/?"))
         .build();
   }

   public static ActionsToRest.RestAction viewLicense() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.viewLicense)
         .rule(ActionsToRest.Rule.of("GET", "/license/?"))
         .rule(ActionsToRest.Rule.of("GET", "/system/?"))
         .rule(ActionsToRest.Rule.of("POST", "/license/activate/?"))
         .rule(ActionsToRest.Rule.of("POST", "/license/validate/?"))
         .build();
   }

   public static ActionsToRest.RestAction viewLog() {
      return ActionsToRest.RestAction.builder().action(Actions.viewLog).rule(ActionsToRest.Rule.of("GET", "/logs/[^/]+/?")).build();
   }

   public static ActionsToRest.RestAction listAdministrators() {
      return ActionsToRest.RestAction.builder().action(Actions.listAdministrators).rule(ActionsToRest.Rule.of("GET", "/administrators/?")).build();
   }

   public static ActionsToRest.RestAction viewAdministrators() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.viewAdministrator)
         .rule(ActionsToRest.Rule.of("GET", "/administrators/[^/]+(/(password|lock|roles(/[^/]+)?)+)?/?"))
         .build();
   }

   public static ActionsToRest.RestAction createAdministrator() {
      return ActionsToRest.RestAction.builder().action(Actions.createAdministrator).rule(ActionsToRest.Rule.of("POST", "/administrators/?")).build();
   }

   public static ActionsToRest.RestAction editAdministrator() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.editAdministrator)
         .rule(ActionsToRest.Rule.of(methods("POST", "PUT"), "/administrators/[^/]+/roles/?"))
         .rule(ActionsToRest.Rule.of(methods("DELETE"), "/administrators/[^/]+/roles/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("PATCH", "/administrators/[^/]+/context-data/?"))
         .build();
   }

   public static ActionsToRest.RestAction deleteAdministrator() {
      return ActionsToRest.RestAction.builder().action(Actions.deleteAdministrator).rule(ActionsToRest.Rule.of("DELETE", "/administrators/[^/]+/?")).build();
   }

   public static ActionsToRest.RestAction lockAdministrator() {
      return ActionsToRest.RestAction.builder().action(Actions.lockAdministrator).rule(ActionsToRest.Rule.of("POST", "/administrators/[^/]+/lock/?")).build();
   }

   public static ActionsToRest.RestAction unlockAdministrator() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.unlockAdministrator)
         .rule(ActionsToRest.Rule.of("DELETE", "/administrators/[^/]+/lock/?"))
         .build();
   }

   public static ActionsToRest.RestAction deleteAdminPassword() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.deleteAdministratorPassword)
         .rule(ActionsToRest.Rule.of("DELETE", "/administrators/[^/]+/password/?"))
         .build();
   }

   public static ActionsToRest.RestAction generateAdminPassword() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.generateAdministratorPassword)
         .rule(ActionsToRest.Rule.of("POST", "/administrators/[^/]+/password/generate/?"))
         .build();
   }

   public static ActionsToRest.RestAction viewTechnicalClients() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.viewTechnicalClients)
         .rule(ActionsToRest.Rule.of("GET", "/tech-clients/?"))
         .rule(ActionsToRest.Rule.of("GET", "/tech-clients/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("GET", "/tech-clients/[^/]+/lock/?"))
         .rule(ActionsToRest.Rule.of("GET", "/tech-clients/[^/]+/api-keys/?"))
         .rule(ActionsToRest.Rule.of("GET", "/tech-clients/[^/]+/subscription/?"))
         .rule(ActionsToRest.Rule.of("GET", "/api-keys/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("GET", "/subscriptions/[^/]+/plan-usages/?"))
         .build();
   }

   public static ActionsToRest.RestAction createEditTechnicalClient() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.createEditTechnicalClient)
         .rule(ActionsToRest.Rule.of("POST", "/tech-clients/?"))
         .rule(ActionsToRest.Rule.of("PATCH", "/tech-clients/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("POST", "/api-keys/?"))
         .rule(ActionsToRest.Rule.of(methods("DELETE", "PATCH"), "/api-keys/[^/]+/?"))
         .rule(ActionsToRest.Rule.of("POST", "/subscriptions/?"))
         .rule(ActionsToRest.Rule.of("POST", "/plan-usages/?"))
         .rule(ActionsToRest.Rule.of(methods("DELETE", "PATCH"), "/plan-usages/[^/]+/?"))
         .build();
   }

   public static ActionsToRest.RestAction deleteTechnicalClient() {
      return ActionsToRest.RestAction.builder().action(Actions.deleteTechnicalClient).rule(ActionsToRest.Rule.of("DELETE", "/tech-clients/[^/]+/?")).build();
   }

   public static ActionsToRest.RestAction lockTechnicalClient() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.lockTechnicalClient)
         .rule(ActionsToRest.Rule.of("POST", "/tech-clients/[^/]+/lock/?"))
         .rule(ActionsToRest.Rule.of("POST", "/api-keys/[^/]+/lock/?"))
         .build();
   }

   public static ActionsToRest.RestAction unlockTechnicalClient() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.unlockTechnicalClient)
         .rule(ActionsToRest.Rule.of("DELETE", "/tech-clients/[^/]+/lock/?"))
         .rule(ActionsToRest.Rule.of("DELETE", "/api-keys/[^/]+/lock/?"))
         .build();
   }

   public static ActionsToRest.RestAction displayUserManagementExtensions() {
      return ActionsToRest.RestAction.builder()
         .action(Actions.displayUserManagementExtensions)
         .rule(ActionsToRest.Rule.of("GET", "/adminapp/user-management-extensions.js"))
         .build();
   }

   private static String methods(String... methods) {
      return String.join(",", methods);
   }
}
