import { IPermission, PermissionRole } from './Permission.js';
import { IModification } from './Modification.js';
import { IDeletion } from './Deletion.js';
import { IUser } from './User.js';
import { IThing, Thing } from '../Thing.js';
import { ICapabilities } from './Capabilities.js';
export interface FileAddOptions {
    /**
     * The parent folder where to put the file.
     * The `parents` array is always cleared from the file object before adding it to the store.
     */
    parent?: string;
}
export interface MediaReadOptions {
    /**
     * When set it reads the file that was marked as `_deleted`. By default it throws when file was deleted.
     */
    deleted?: boolean;
}
/**
 * A breadcrumb when creating the breadcrumb list for a file.
 */
export interface FileBreadcrumb {
    /**
     * The datastore key of the object.
     */
    key: string;
    /**
     * THe kind of the object.
     */
    kind: string;
    /**
     * The name of the object.
     */
    name: string;
}
export interface IStoredFile {
    /**
     * The kind of the File
     */
    kind: string;
    /**
     * The identifier of the entity
     */
    key: string;
    /**
     * The file's meta info.
     */
    info: IThing;
    /**
     * The color of the icon to render for this file in the file explorer.
     * This should be a hex format, e.g.: #c00 for red.
     */
    iconColor?: string;
    /**
     * Whether the file is a shortcut to another file.
     * Many properties cannot be changed of a shortcut, like, shortcuts cannot be shared.
     */
    isShortcut?: boolean;
    /**
     * The ID of the target file.
     */
    shortcutTarget?: string;
}
/**
 * An interface describing an object in the data store that
 * describes a file or an object that can be treated as a file or a folder.
 */
export interface IFile extends IStoredFile {
    /**
     * The list of parents of the object. It is an ordered list of parents
     * from the top (first element) to the lowest parent in the tree (last element).
     *
     * After creating the object, this property cannot be manipulated directly by the client.
     * Should be treated as opaque value.
     */
    parents: string[];
    /**
     * The list of permissions to this file object.
     *
     * This property cannot be manipulated directly by the client. Should be treated as
     * opaque value.
     */
    permissionIds: string[];
    /**
     * Whether the file object is deleted.
     */
    deleted?: boolean;
    /**
     * The information about the delete information.
     * Always set when the `delete` is true.
     */
    deletedInfo?: IDeletion;
    /**
     * The last modification made to this file.
     */
    lastModified: IModification;
    /**
     * An arbitrary list of labels applied to the file.
     */
    labels?: string[];
    /**
     * This is populated when reading a file from the store.
     * A list of actions the user can perform on the file.
     *
     * This is a readonly field and it is ignored when creating / updating the file.
     */
    capabilities?: ICapabilities;
    /**
     * Populated by the server when reading the file. The list of permissions to the object.
     *
     * This property cannot be manipulated directly by the client. Should be treated as
     * opaque value.
     *
     * Data store implementation note, this is not stored in the store but it is populated
     * when reading the object.
     */
    permissions: IPermission[];
    /**
     * Populated by the store in some situations. If it's missing then you should request
     * breadcrumbs from the store.
     */
    breadcrumb?: FileBreadcrumb[];
}
declare const parentsSymbol: unique symbol;
declare const deletedSymbol: unique symbol;
declare const deletedInfoSymbol: unique symbol;
declare const lastModifiedSymbol: unique symbol;
declare const capabilitiesSymbol: unique symbol;
declare const permissionsSymbol: unique symbol;
declare const permissionIdsSymbol: unique symbol;
declare const shortcutTargetSymbol: unique symbol;
export declare class StoredFile {
    /**
     * The kind of the File
     */
    kind: string;
    /**
     * The identifier of the entity
     */
    key: string;
    /**
     * The name of the environment.
     */
    info: Thing;
    /**
     * The color of the icon to render for this file in the file explorer.
     */
    iconColor?: string;
    /**
     * Whether the file is a shortcut to another file.
     * Many properties cannot be changed of a shortcut, like, shortcuts cannot be shared.
     */
    get isShortcut(): boolean;
    [shortcutTargetSymbol]?: string;
    /**
     * The ID of the target file.
     */
    get shortcutTarget(): string | undefined;
    set shortcutTarget(value: string | undefined);
    /**
     * Creates a file schema object with the given properties.
     * The `key` is generated if not set.
     *
     * @param input The input to create the file schema.
     * @returns The file schema object.
     */
    static createSchema(input?: Partial<IStoredFile>): IStoredFile;
    constructor(state: IStoredFile);
    /**
     * @deprecated Use `createSchema()` and setup values in the constructor instead.
     */
    new(init: IStoredFile): this;
    toJSON(): IStoredFile;
    /**
     * Creates the Capabilities object for a file giving user level.
     *
     * @param file The file object to create the capabilities to. The object is not mutated.
     * @param role The user role to the file.
     */
    static createFileCapabilities(file: IStoredFile | StoredFile, role?: PermissionRole): ICapabilities;
    createFileCapabilities(role: PermissionRole): ICapabilities;
    /**
     * Mutates the file object by setting the `byMe` properties (on deleted and modified info)
     *
     * Note, this can be done only on file schema (IFile). The `File` object has
     * this properties frozen.
     *
     * @param file The file to mutate
     * @param user The user key to compare.
     */
    static updateByMeMeta(file: IFile, user: string): void;
    /**
     * Static method to set the `lastModified` property on a file without creating an instance of a file meta.
     * Useful when the meta kind is unknown.
     *
     * @param file The file to update. Note, this method mutates the file.
     * @param user The user that modifies the file.
     * @returns The same file.
     */
    static setLastModified(file: IFile, user: IUser): IFile;
    /**
     * Similar to the instance method `setDeleted()` but without creating
     * an instance of the file when the type is unknown.
     *
     * @param file The file to change. Note, this operation mutates the file.
     * @param user The deleting user
     * @returns The same file reference.
     */
    static setDeleted(file: IFile, user: IUser): IFile;
}
export declare class File extends StoredFile {
    [parentsSymbol]: string[];
    /**
     * The list of parents of the object. It is an ordered list of parents
     * from the top (first element) to the lowest parent in the tree (last element).
     *
     * This property cannot be manipulated directly by the client. Should be treated as
     * opaque value.
     */
    get parents(): string[];
    [permissionIdsSymbol]: readonly string[];
    /**
     * The list of permissions to this file object.
     *
     * This property cannot be manipulated directly by the client. Should be treated as
     * opaque value.
     */
    get permissionIds(): readonly string[];
    [deletedSymbol]?: boolean;
    /**
     * Whether the file object is deleted.
     */
    get deleted(): boolean;
    [deletedInfoSymbol]?: Readonly<IDeletion>;
    /**
     * The information about the delete information.
     * Always set when the `delete` is true.
     */
    get deletedInfo(): Readonly<IDeletion> | undefined;
    [lastModifiedSymbol]: Readonly<IModification>;
    /**
     * The last modification made to this file.
     */
    get lastModified(): Readonly<IModification>;
    /**
     * An arbitrary list of labels applied to the file.
     */
    labels?: string[];
    [capabilitiesSymbol]?: Readonly<ICapabilities>;
    /**
     * This is populated when reading a file from the store.
     * A list of actions the user can perform on the file.
     *
     * This is a readonly field and it is ignored when creating / updating the file.
     */
    get capabilities(): Readonly<ICapabilities> | undefined;
    [permissionsSymbol]: readonly IPermission[];
    /**
     * Populated by the server when reading the file. The list of permissions to the object.
     *
     * This property cannot be manipulated directly by the client. Should be treated as
     * opaque value.
     */
    get permissions(): readonly IPermission[];
    static createSchema(input?: Partial<IFile>): IFile;
    constructor(state?: Partial<IFile>);
    /**
     * @deprecated Use `createSchema()` and setup values in the constructor instead.
     */
    new(init: IFile): this;
    toJSON(): IFile;
    /**
     * @param name The name to set.
     * @param kind The kind of the file to create.
     */
    static fromName(name: string, kind: string): File;
    shortcutTo(fileId: string): this;
    /**
     * Updates the "lastModified" value.
     * A helper method for a common task.
     *
     * @param user The user that modifies the entity.
     */
    setLastModified(user: IUser): void;
    /**
     * Adds a label to the list of labels.
     *
     * It makes sure the value is a valid, non-empty string and the `labels` array is set.
     *
     * It does nothing when the label already exists.
     *
     * @param label The label to set.
     */
    addLabel(label: string): void;
    /**
     * Marks the entity as deleted.
     *
     * A helper method for a common task.
     *
     * @param user The user that deletes the entity.
     */
    setDeleted(user: IUser): void;
    isFile(): boolean;
    isFolder(): boolean;
}
export {};
//# sourceMappingURL=File.d.ts.map