/**
 * Copyright 2023-present DreamNum Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import type { FRange } from '../f-range';
import type { IRangeProtectionOptions, RangePermissionSnapshot } from './permission-types';
import { IAuthzIoService, ICommandService, Injector, IPermissionService } from '@univerjs/core';
import { RangeProtectionRuleModel } from '@univerjs/sheets';
import { RangePermissionPoint } from './permission-types';
/**
 * Implementation class for range protection rules
 * Encapsulates operations on a single protection rule
 *
 * @hideconstructor
 */
export declare class FRangeProtectionRule {
    private readonly _unitId;
    private readonly _subUnitId;
    private readonly _ruleId;
    private readonly _permissionId;
    private readonly _ranges;
    private readonly _options;
    private readonly _injector;
    private readonly _permissionService;
    private readonly _authzIoService;
    private readonly _commandService;
    private readonly _rangeProtectionRuleModel;
    constructor(_unitId: string, _subUnitId: string, _ruleId: string, _permissionId: string, _ranges: FRange[], _options: IRangeProtectionOptions, _injector: Injector, _permissionService: IPermissionService, _authzIoService: IAuthzIoService, _commandService: ICommandService, _rangeProtectionRuleModel: RangeProtectionRuleModel);
    /**
     * Get the rule ID.
     */
    get id(): string;
    /**
     * Get the permission ID associated with this rule.
     */
    get permissionId(): string;
    /**
     * Get the protected ranges.
     */
    get ranges(): FRange[];
    /**
     * Get the protection options.
     */
    get options(): IRangeProtectionOptions;
    /**
     * Update the protected ranges.
     * @param {FRange[]} ranges New ranges to protect.
     * @returns {Promise<boolean>} A promise resolving to whether the protected ranges were updated.
     * @example
     * ```ts
     * const fWorkbook = univerAPI.getActiveWorkbook();
     * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
     * if (!fWorksheet) return;
     * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
     * // Update the ranges to A1:C3 for the first rule
     * if (rules.length > 0) {
     *   const rule = rules[0];
     *   const result = await rule.updateRanges([fWorksheet.getRange('A1:C3')]);
     *   console.log(result);
     * }
     * ```
     */
    updateRanges(ranges: FRange[]): Promise<boolean>;
    /**
     * Delete the current protection rule.
     * @returns {Promise<boolean>} A promise resolving to whether the rule was removed.
     * @example
     * ```ts
     * const fWorkbook = univerAPI.getActiveWorkbook();
     * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
     * if (!fWorksheet) return;
     * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
     * // Remove the first protection rule
     * if (rules.length > 0) {
     *   const rule = rules[0];
     *   const result = await rule.remove();
     *   console.log(result);
     * }
     * ```
     */
    remove(): Promise<boolean>;
    /**
     * Set a specific permission point for the range rule (low-level API).
     *
     * **Important:** This method only updates the permission point value for an existing protection rule.
     * It does NOT create permission checks that will block actual editing operations.
     * You must call `protect()` first to create a protection rule before using this method.
     *
     * This method is useful for:
     * - Fine-tuning permissions after creating a protection rule with `protect()`
     * - Dynamically adjusting permissions based on runtime conditions
     * - Advanced permission management scenarios
     *
     * @param {RangePermissionPoint} point The permission point to set.
     * @param {boolean} value The value to set (true = allowed, false = denied).
     * @returns {Promise<void>} A promise that resolves when the point is set.
     * @throws {Error} If no protection rule exists for this range.
     *
     * @example
     * ```ts
     * const fWorkbook = univerAPI.getActiveWorkbook();
     * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
     * if (!fWorksheet) return;
     * const fRange = fWorksheet.getRange('A1:B2');
     * // First, create a protection rule
     * const rule = await fRange.getRangePermission().protect({ name: 'My Range', allowEdit: true });
     * // Then you can dynamically update permission points
     * await rule.setPoint(univerAPI.Enum.RangePermissionPoint.Edit, false); // Now disable edit
     * await rule.setPoint(univerAPI.Enum.RangePermissionPoint.View, true);  // Ensure view is enabled
     * ```
     */
    setPoint(point: RangePermissionPoint, value: boolean): Promise<void>;
    /**
     * Get the value of a specific permission point.
     * @param {RangePermissionPoint} point The range permission point to query.
     * @returns {boolean} true if allowed, false if denied.
     * @example
     * ```ts
     * const fWorkbook = univerAPI.getActiveWorkbook();
     * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
     * if (!fWorksheet) return;
     * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
     * // Check if the first rule allows editing
     * if (rules.length > 0) {
     *   const rule = rules[0];
     *   const canEdit = rule.getPoint(univerAPI.Enum.RangePermissionPoint.Edit);
     *   console.log(canEdit);
     * }
     * ```
     */
    getPoint(point: RangePermissionPoint): boolean;
    /**
     * Check if the current user can edit this range.
     * @returns {boolean} true if editable, false otherwise.
     * @example
     * ```ts
     * const fWorkbook = univerAPI.getActiveWorkbook();
     * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
     * if (!fWorksheet) return;
     * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
     * // Check if the first rule allows editing
     * const rule = rules[0];
     * if (rule?.canEdit()) {
     *   console.log(`You can edit this range ${rule.ranges.map(r => r.getA1Notation()).join(', ')}`);
     * }
     * ```
     */
    canEdit(): boolean;
    /**
     * Check if the current user can view this range.
     * @returns {boolean} true if viewable, false otherwise.
     * @example
     * ```ts
     * const fWorkbook = univerAPI.getActiveWorkbook();
     * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
     * if (!fWorksheet) return;
     * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
     * // Check if the first rule allows viewing
     * const rule = rules[0];
     * if (rule?.canView()) {
     *   console.log(`You can view this range ${rule.ranges.map(r => r.getA1Notation()).join(', ')}`);
     * }
     * ```
     */
    canView(): boolean;
    /**
     * Check if the current user can manage collaborators for this range.
     * @returns {boolean} true if can manage collaborators, false otherwise.
     * @example
     * ```ts
     * const fWorkbook = univerAPI.getActiveWorkbook();
     * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
     * if (!fWorksheet) return;
     * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
     * // Check if the first rule allows managing collaborators
     * const rule = rules[0];
     * if (rule?.canManageCollaborator()) {
     *   console.log(`You can manage collaborators for this range ${rule.ranges.map(r => r.getA1Notation()).join(', ')}`);
     * }
     * ```
     */
    canManageCollaborator(): boolean;
    /**
     * Check if the current user can delete this protection rule.
     * @returns {boolean} true if can delete rule, false otherwise.
     * @example
     * ```ts
     * const fWorkbook = univerAPI.getActiveWorkbook();
     * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
     * if (!fWorksheet) return;
     * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
     * // Check if the first rule allows deleting the rule
     * const rule = rules[0];
     * if (rule?.canDelete()) {
     *   console.log(`You can delete this protection rule for this range ${rule.ranges.map(r => r.getA1Notation()).join(', ')}`);
     * }
     * ```
     */
    canDelete(): boolean;
    /**
     * Get the current permission snapshot.
     * @returns {RangePermissionSnapshot} Snapshot of all permission points.
     * @example
     * ```ts
     * const fWorkbook = univerAPI.getActiveWorkbook();
     * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
     * if (!fWorksheet) return;
     * const rules = await fWorksheet.getWorksheetPermission().listRangeProtectionRules();
     * // Get the permission snapshot of the first rule
     * if (rules.length > 0) {
     *   const rule = rules[0];
     *   const snapshot = rule.getSnapshot();
     *   console.log(snapshot);
     * }
     * ```
     */
    getSnapshot(): RangePermissionSnapshot;
}
