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>;
    getUserOrganization(id: string): Promise<IOrganization>;
    currentOrganization(): Promise<IOrganization | undefined>;
    protected hasGrantType(grantType: UserOrganizationGrantType): Promise<boolean>;
    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>;
    /**
     * When the user has no organizations, it set the organization as the only one
     * and persists the organization id as the selected organization.
     * @param org The organization to add.
     */
    setupUserOrganization(org: IOrganization): Promise<void>;
}
export {};
//# sourceMappingURL=OrganizationService.d.ts.map