import { EuiService, EuiServiceStatus, EuiUserRight } from '@eui/base';
import { Observable } from 'rxjs';
import { LogService } from '../log';
import { StoreService } from '../store';
import * as i0 from "@angular/core";
/**
 * Service for managing user permissions within the application.
 * This class extends `EuiService` and is responsible for handling user rights and permissions.
 * It provides methods to initialize the service with user rights, check specific rights and permissions,
 * and subscribe to changes in the user rights state.
 *
 * @extends {EuiService<EuiUserRight[]>}
 * @see EuiService
 *
 * @example
 * // Example of using the EuiPermissionService in an application
 * const permissionService = new EuiPermissionService();
 * permissionService.init([{ id: 'ADMIN', permissions: ['CREATE', 'READ', 'UPDATE', 'DELETE'] }]);
 * if (permissionService.checkRight('ADMIN')) {
 *   console.log('User has ADMIN rights');
 * }
 */
export declare class EuiPermissionService extends EuiService<EuiUserRight[]> {
    private log;
    protected store: StoreService;
    private readonly logger;
    constructor(log: LogService, store: StoreService);
    /**
     * Initializes the permission service with a set of user rights.
     * This method sets up the initial state of the service based on the provided user rights.
     * It should be called before using other methods of the service to ensure it is properly configured.
     *
     * @param {EuiUserRight[]} rights - An array of user rights to initialize the service with.
     *                                  Each `EuiUserRight` object should contain at least an `id` property,
     *                                  and optionally a `permissions` property which is an array of strings.
     *
     * @returns {Observable<EuiServiceStatus>} An Observable that emits the status of the initialization.
     *                                         The status object includes a `success` boolean indicating
     *                                         whether the initialization was successful, and an `error` property
     *                                         with a message in case of failure.
     *
     * @example
     * // Example of initializing the service with two user rights
     * const userRights = [
     *   { id: 'ADMIN', permissions: ['CREATE', 'READ', 'UPDATE', 'DELETE'] },
     *   { id: 'USER', permissions: ['READ'] }
     * ];
     * permissionService.init(userRights).subscribe(status => {
     *   if (status.success) {
     *     console.log('Initialization successful');
     *   } else {
     *     console.error('Initialization failed:', status.error);
     *   }
     * });
     *
     * @throws {Error} Throws an error if the `rights` parameter is not an array of `EuiUserRight` objects.
     */
    init(rights: EuiUserRight[]): Observable<EuiServiceStatus>;
    /**
     * Retrieves the current user rights from the service's state.
     * This getter provides access to the array of `EuiUserRight` objects that represent the current rights
     * of the user. It is a protected method, intended for internal use within the service or by subclasses.
     *
     * @returns {EuiUserRight[]} An array of `EuiUserRight` objects representing the current user rights.
     *                           Each `EuiUserRight` object typically contains an `id` property, and may
     *                           also include a `permissions` property which is an array of strings.
     *
     * @example
     * // Example of accessing user rights within a subclass or within the service
     * const currentRights = this.userRights;
     * currentRights.forEach(right => {
     *   console.log(`Right ID: ${right.id}, Permissions: ${right.permissions.join(', ')}`);
     * });
     *
     * @protected
     */
    protected get userRights(): EuiUserRight[];
    /**
     * Retrieves the current state of user rights by subscribing to changes.
     * This method is used to access the current state of user rights in the service. It returns an Observable
     * that emits the current user rights. The method is generic and can be parameterized to return a specific
     * type that extends from `EuiUserRight[]`.
     *
     * @template K - The type of the user rights state to be returned. Defaults to `EuiUserRight[]` if not specified.
     *
     * @returns {Observable<K>} An Observable that emits the current state of user rights.
     *                          The type of the emitted value is `K`, which is `EuiUserRight[]` by default.
     *
     * @example
     * // Example of subscribing to the user rights state
     * permissionService.getState().subscribe(currentRights => {
     *   console.log('Current User Rights:', currentRights);
     * });
     *
     * // Example with a specific type
     * permissionService.getState<CustomUserRightType[]>().subscribe(customRights => {
     *   console.log('Custom User Rights:', customRights);
     * });
     */
    getState<K = EuiUserRight[]>(): Observable<K>;
    /**
     * Updates the state of the service with a new set of user rights.
     * This method is used to modify the current user rights in the service. It takes an array of `EuiUserRight`
     * objects and updates the service's state. This change is then propagated to all subscribers of the state.
     *
     * @param {EuiUserRight[]} rights - An array of `EuiUserRight` objects to update the service's state with.
     *                                  Each `EuiUserRight` object should contain an `id` property,
     *                                  and optionally a `permissions` property which is an array of strings.
     *
     * @example
     * // Example of updating the service's state with new user rights
     * const newUserRights = [
     *   { id: 'USER', permissions: ['READ', 'COMMENT'] },
     *   { id: 'MODERATOR', permissions: ['READ', 'WRITE', 'DELETE'] }
     * ];
     * permissionService.updateState(newUserRights);
     */
    updateState(rights: EuiUserRight[]): void;
    /**
     * Checks if the user has the specified attribute permission.
     * This method interprets a string that represents a combination of rights and/or permissions
     * and determines whether the user has the specified permissions. The string format can be
     * 'RIGHT.PERMISSION' or just 'RIGHT'. For multiple rights, it can be 'RIGHT1.RIGHT2.PERMISSION'.
     *
     * @param {string} rightsAndPermission - A string representing the rights and/or permissions to check.
     *                                       Format can be 'RIGHT', 'RIGHT.PERMISSION', or 'RIGHT1.RIGHT2.PERMISSION'.
     *
     * @returns {boolean} True if the user has the specified attribute permission, false otherwise.
     *
     * @example
     * // Check a single right
     * const hasRight = permissionService.checkAttributePermission('VIEW');
     *
     * // Check a right with a specific permission
     * const hasRightWithPermission = permissionService.checkAttributePermission('EDIT.APPROVE');
     *
     * // Check multiple rights with a specific permission
     * const hasMultipleRights = permissionService.checkAttributePermission('ADMIN.VIEW.APPROVE');
     */
    checkAttributePermission(rightsAndPermission: string): boolean;
    /**
     * Checks if the user has a specific right.
     * This method determines whether the user possesses a particular right identified by its ID.
     *
     * @param {string} rightId - The ID of the right to check.
     *
     * @returns {boolean} True if the user has the specified right, false otherwise.
     *
     * @example
     * // Check if the user has the 'ADMIN' right
     * const isAdmin = permissionService.checkRight('ADMIN');
     */
    checkRight(rightId: string): boolean;
    /**
     * Checks if the user has a specific permission within a right.
     * This method determines whether the user has a specific permission associated with a given right.
     *
     * @param {string} rightId - The ID of the right.
     * @param {string} permission - The permission to check within the right.
     *
     * @returns {boolean} True if the user has the specified permission in the given right, false otherwise.
     *
     * @example
     * // Check if the user has 'APPROVE' permission in the 'EDIT' right
     * const canApproveEdit = permissionService.checkPermission('EDIT', 'APPROVE');
     */
    checkPermission(rightId: string, permission: string): boolean;
    /**
     * Checks if the user has all the specified rights.
     * This private method determines whether the user possesses all the rights provided in the array.
     * Each right in the array is checked against the user's current rights.
     *
     * @param {EuiUserRight[]} rights - An array of rights to check against the user's rights.
     *
     * @returns {boolean} True if the user has all the specified rights, false otherwise.
     *
     * @example
     * // Example usage within the service
     * const requiredRights = [{ id: 'VIEW' }, { id: 'EDIT' }];
     * const hasAllRequiredRights = this.haveAllRights(requiredRights);
     *
     * @private
     */
    private haveAllRights;
    static ɵfac: i0.ɵɵFactoryDeclaration<EuiPermissionService, [{ optional: true; }, null]>;
    static ɵprov: i0.ɵɵInjectableDeclaration<EuiPermissionService>;
}
//# sourceMappingURL=permission.service.d.ts.map