import { Service } from '../core/Service.js';
import type { IOrganization, UserOrganizationGrantType } from '@api-client/core/models/store/Organization.js';
declare enum State {
    NotChecked = 0,
    Checking = 1,
    Checked = 2
}
export declare enum CompletionState {
    /**
     * The user has at least one organization and the current organization is selected.
     */
    OK = 0,
    /**
     * The user has at leas two organizations and no valid selection.
     */
    NotSelected = 1,
    /**
     * The user have no organizations. Setup is needed.
     */
    NoOrganizations = 2,
    /**
     * Unable to determine the state due to an error.
     */
    Error = 3
}
export default class OrganizationService extends Service {
    #private;
    static key: string;
    state: State;
    organizations: IOrganization[];
    organizationId: string | undefined;
    /**
     * A pending organization ID that was set via the URL query parameter `oid`.
     * When it is set, it preselects the organization when loading list of organizations.
     * This will override the `organizationId` set in the local storage.
     */
    pendingOid: string | undefined | null;
    protected onCreate(): Promise<void>;
    /**
     * @deprecated Use #setOrganization instead
     */
    setupUserOrganization(org: IOrganization): Promise<void>;
    /**
     * Sets an org as the current user org.
     * @param org The organization to add.
     */
    setOrganization(org: IOrganization): Promise<void>;
    /**
     * Adds an organization to the list of organizations.
     * It also updated the cache. Used when creating a new org.
     * @param org The organization to add.
     */
    addOrganization(org: IOrganization): Promise<void>;
    /**
     * Removes an organization from the list of organizations.
     * It also updated the cache. Used when deleting an org.
     * @param org The organization to remove.
     */
    removeOrganization(org: IOrganization): Promise<void>;
    /**
     * @deprecated Use #readOrganization instead
     */
    getUserOrganization(id: string): Promise<IOrganization>;
    /**
     * Reads an organization from the list of organizations.
     * @param id The organization ID.
     * @returns The organization.
     */
    readOrganization(id: string): Promise<IOrganization>;
    /**
     * Gets the current user organization.
     * @returns The current organization or undefined if not set.
     */
    currentOrganization(): Promise<IOrganization | undefined>;
    /**
     * Checks if the user has a specific grant type in the current organization.
     * @param grantType The grant type to check.
     * @returns `true` if the user has the specified grant type, `false` otherwise.
     */
    protected hasGrantType(grantType: UserOrganizationGrantType): Promise<boolean>;
    /**
     * Checks if the user has any of the specified grant types in the current organization.
     * @param types The grant types to check.
     * @returns `true` if the user has any of the specified grant types, `false` otherwise.
     */
    hasRoles(types: UserOrganizationGrantType[]): Promise<boolean>;
    /**
     * Checks if the user is the owner of the current organization.
     * @returns `true` if the user is the owner of the current organization, `false` otherwise.
     */
    isOwner(): Promise<boolean>;
    /**
     * Checks if the user is a manager of the current organization.
     * @returns `true` if the user is a manager of the current organization, `false` otherwise.
     */
    isManager(): Promise<boolean>;
    /**
     * Checks if the user is an editor of the current organization.
     * @returns `true` if the user is a editor of the current organization, `false` otherwise.
     */
    isEditor(): Promise<boolean>;
    /**
     * Forces to get the list of organizations from the server.
     *
     * Returns one of the following states:
     *
     * - `CompletionState.OK` - The user has at least one organization and the current organization is selected.
     * - `CompletionState.NotSelected` - The user has at leas two organizations and no valid selection.
     * - `CompletionState.NoOrganizations` - The user have no organizations. Setup is needed.
     * - `CompletionState.Error` - Unable to determine the state due to an error.
     *
     * @returns The state of the organization creation.
     */
    revalidate(): Promise<CompletionState>;
}
export {};
//# sourceMappingURL=OrganizationService.d.ts.map