declare class ApiClient {
    private jwt;
    private requestInitOption;
    private baseUrl;
    constructor(baseUrl: string, jwtSecret?: string, userId?: string);
    getMergeRequestInitOption(extraOptions?: RequestInit): RequestInit;
    processJsonResponse<T = any>(res: Response): Promise<T>;
    /**
     * Get the data of a user.
     *
     * @param {string} userId
     * @returns {Promise<Maybe<User>>}
     * @memberof ApiClient
     */
    getUser(userId: string): Promise<Maybe<RequiredKeys<User, "id">>>;
    /**
     * Lookup user by source (identity provider) & sourceId (identity ID)
     *
     * @param {string} source
     * @param {string} sourceId
     * @returns {Promise<Maybe<User>>}
     * @memberof ApiClient
     */
    lookupUser(source: string, sourceId: string): Promise<Maybe<RequiredKeys<User, "id">>>;
    /**
     * create a user
     *
     * @param {CreateUserData} user
     * @returns {Promise<UserRecord>}
     * @memberof ApiClient
     */
    createUser(user: CreateUserData): Promise<UserRecord>;
    /**
     * Add Roles to a user.
     * Returns a list of current role ids of the user.
     *
     * @param {string} userId
     * @param {string[]} roleIds
     * @returns {Promise<string[]>}
     * @memberof ApiClient
     */
    addUserRoles(userId: string, roleIds: string[]): Promise<string[]>;
    /**
     * Remove a list roles from a user.
     *
     * @param {string} userId
     * @param {string[]} roleIds
     * @returns {Promise<void>}
     * @memberof ApiClient
     */
    deleteUserRoles(userId: string, roleIds: string[]): Promise<void>;
    /**
     * Get all roles of a user
     *
     * @param {string} userId
     * @returns {Promise<Role[]>}
     * @memberof ApiClient
     */
    getUserRoles(userId: string): Promise<Role[]>;
    /**
     * Get all permissions of a user
     *
     * @param {string} userId
     * @returns {Promise<Permission[]>}
     * @memberof ApiClient
     */
    getUserPermissions(userId: string): Promise<Permission[]>;
    /**
     * Get all permissions of a role
     *
     * @param {string} roleId
     * @returns {Promise<Permission[]>}
     * @memberof ApiClient
     */
    getRolePermissions(roleId: string): Promise<Permission[]>;
    /**
     * List OrgUnits at certain org tree level.
     * Optionally provide a test Org Unit Id that will be used to test the relationship with each of returned orgUnit item.
     * Possible Value: 'ancestor', 'descendant', 'equal', 'unrelated'
     *
     * @param {string} orgLevel The level number (starts from 1) where org Units of the tree are taken horizontally.
     * @param {string} [relationshipOrgUnitId] Optional; The org unit id that is used to test the relationship with each of returned orgUnit item.
     * @returns {Promise<OrgUnit[]>}
     * @memberof ApiClient
     */
    getOrgUnitsByLevel(orgLevel: number, relationshipOrgUnitId?: string): Promise<OrgUnit[]>;
    /**
     * Get orgunits by name
     *
     * @param {string} nodeName
     * @param {boolean} [leafNodesOnly=false] Whether only leaf nodes should be returned
     * @param {string} [relationshipOrgUnitId] Optional; The org unit id that is used to test the relationship with each of returned orgUnit item.
     * @returns {Promise<OrgUnit[]>}
     * @memberof ApiClient
     */
    getOrgUnitsByName(nodeName: string, leafNodesOnly?: boolean, relationshipOrgUnitId?: string): Promise<OrgUnit[]>;
    /**
     * Gets the root organisation unit (top of the tree).
     *
     * @returns {Promise<OrgUnit>}
     * @memberof ApiClient
     */
    getRootOrgUnit(): Promise<OrgUnit>;
    /**
     * Gets the details of the node with its id.
     *
     * @param {string} nodeId
     * @returns {Promise<OrgUnit>}
     * @memberof ApiClient
     */
    getOrgUnitById(nodeId: string): Promise<OrgUnit>;
    /**
     * Gets all the children immediately below the requested node. If the node doesn't exist, returns an empty list.
     *
     * @param {string} nodeId
     * @returns {Promise<OrgUnit[]>}
     * @memberof ApiClient
     */
    getImmediateOrgUnitChildren(nodeId: string): Promise<OrgUnit[]>;
    /**
     * Gets all the children below the requested node recursively. If node doesn't exist, returns an empty list.
     *
     * @param {string} nodeId
     * @returns {Promise<OrgUnit[]>}
     * @memberof ApiClient
     */
    getAllOrgUnitChildren(nodeId: string): Promise<OrgUnit[]>;
    createOrgNode(parentNodeId: string, node: Partial<Omit<OrgUnitRecord, "id" | "createBy" | "createTime" | "editBy" | "editTime" | "left" | "right">>): Promise<OrgUnit>;
    createRole(name: string, desc?: string): Promise<Role>;
    createRolePermission(roleId: string, permissionData: CreateRolePermissionInputData): Promise<PermissionRecord>;
    createPermission(permissionData: CreateRolePermissionInputData): Promise<PermissionRecord>;
    updatePermission(id: string, permissionData: UpdateRolePermissionInputData): Promise<PermissionRecord>;
    getOperationByUri(opUri: string): Promise<OperationRecord>;
    getResourceByUri(resUri: string): Promise<ResourceRecord>;
    private handleGetResult;
}
export default ApiClient;

declare interface CreateRolePermissionInputData extends Omit<PermissionRecord, "id" | "owner_id" | "create_by" | "create_time" | "edit_by" | "edit_time" | "allow_exemption" | "resource_id"> {
    operationIds?: string[];
    operationUris?: string[];
    resource_id?: string;
    resourceUri?: string;
    allow_exemption?: boolean;
}

declare type CreateUserData = Partial<Omit<UserRecord, "email" | "displayName" | "id">> & Pick<UserRecord, "displayName" | "email">;

declare interface Eq<T> {
    equals(t: T): boolean;
}

declare interface Functor<T> {
    fmap<U>(f: (t: T) => U): Functor<U>;
    lift<U>(f: (t: T) => U): Functor<U>;
    map<U>(f: (t: T) => U): Functor<U>;
}

export declare class Maybe<T> implements Monad<T>, Functor<T>, Eq<Maybe<T>> {
    private type;
    private value?;
    constructor(type: MaybeType, value?: T);
    static sequence<T>(t: {
        [k: string]: Maybe<T>;
    }): Maybe<{
        [k: string]: T;
    }>;
    static all: (t: {
        [k: string]: Maybe<any>;
    }) => Maybe<{
        [k: string]: any;
    }>;
    static maybe<T>(t?: T | null): Maybe<T>;
    static just<T>(t: T): Maybe<T>;
    static nothing<T>(): Maybe<T>;
    static isJust<T>(t: Maybe<T>): boolean;
    static isNothing<T>(t: Maybe<T>): boolean;
    unit<U>(u: U): Maybe<U>;
    bind<U>(f: (t: T) => Maybe<U>): Maybe<U>;
    of: <U>(u: U) => Maybe<U>;
    chain: <U>(f: (t: T) => Maybe<U>) => Maybe<U>;
    fmap<U>(f: (t: T) => U): Maybe<U>;
    lift: <U>(f: (t: T) => U) => Maybe<U>;
    map: <U>(f: (t: T) => U) => Maybe<U>;
    caseOf<U>(patterns: MaybePatterns<T, U>): U;
    defaulting(defaultValue: T): Maybe<T>;
    equals(other: Maybe<T>): any;
    valueOr<U extends T>(defaultValue: U): T | U;
    valueOrCompute<U extends T>(defaultValueFunction: () => U): T | U;
    valueOrThrow(error?: Error): T;
    do(patterns?: Partial<MaybePatterns<T, void>>): Maybe<T>;
}

declare interface MaybePatterns<T, U> {
    just: (t: T) => U;
    nothing: () => U;
}

declare enum MaybeType {
    Nothing = 0,
    Just = 1
}

declare interface Monad<T> {
    unit<U>(t: U): Monad<U>;
    bind<U>(f: (t: T) => Monad<U>): Monad<U>;
    of<U>(t: U): Monad<U>;
    chain<U>(f: (t: T) => Monad<U>): Monad<U>;
}

export declare interface Operation {
    id: string;
    uri: string;
    name: string;
    description?: string;
}

declare type OperationRecord = {
    id: string;
    uri: string;
    name: string;
    description: string;
    resource_id: string;
};

export declare type OrgUnit = Partial<OrgUnitRecord> & {
    relationship?: OrgUnitRelationshipType;
};

declare interface OrgUnitRecord {
    id: string;
    name: string;
    description: string;
    left: number;
    right: number;
    createBy: string;
    createTime: Date;
    editBy: string;
    editTime: Date;
}

export declare type OrgUnitRelationshipType = "ancestor" | "descendant" | "equal" | "unrelated";

export declare interface Permission {
    id: string;
    name: string;
    description?: string;
    resourceId: string;
    resourceUri: string;
    userOwnershipConstraint: boolean;
    orgUnitOwnershipConstraint: boolean;
    preAuthorisedConstraint: boolean;
    operations: Operation[];
    createBy?: string;
    createTime?: Date;
    editBy?: string;
    editTime?: Date;
    allowExemption: boolean;
}

declare interface PermissionRecord {
    id: string;
    name: string;
    description: string;
    resource_id: string;
    user_ownership_constraint: boolean;
    org_unit_ownership_constraint: boolean;
    pre_authorised_constraint: boolean;
    owner_id: string;
    create_time: string;
    create_by: string;
    edit_time: string;
    edit_by: string;
    allow_exemption: boolean;
}

export declare type PublicUser = Partial<Pick<UserRecord, "id" | "photoURL" | "orgUnitId">> & Omit<UserRecord, "id" | "photoURL" | "orgUnitId" | "email" | "source" | "sourceId"> & {
    roles?: Role[];
    permissions?: Permission[];
    managingOrgUnitIds?: string[];
    orgUnit?: OrgUnit;
};

declare type RequiredKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;

declare type ResourceRecord = {
    id: string;
    uri: string;
    name: string;
    description: string;
};

export declare interface Role {
    id: string;
    name: string;
    permissionIds: string[];
    description?: string;
    createBy?: string;
    createTime?: Date;
    editBy?: string;
    editTime?: Date;
}

declare interface UpdateRolePermissionInputData extends Partial<CreateRolePermissionInputData> {
}

export declare type User = PublicUser & Pick<UserRecord, "email" | "source" | "sourceId">;

declare interface UserRecord {
    id: string;
    displayName: string;
    photoURL: string;
    orgUnitId: string;
    email: string;
    source: string;
    sourceId: string;
}

export declare interface UserToken {
    id: string;
}

export { }
