import { FileTypes } from 'src/types/attachments';
import { Tree } from 'src/types/breadcrumbs';
import { Pagination } from 'src/types/services';
import { User } from 'src/types/user';

export type File = {
  id: number;
  name: string;
  type?: FileTypes;
  source: string | null;
  depth?: number;
  size: string | null;
  createdAt: string;
  updatedAt: string;
  uploader?: User;
  shared?: boolean;
  public?: boolean;
  extension: string | null;
  parentId?: number | null;
  parentName?: string;
  position?: number;
};

export type FileLeaf = {
  id: number;
  name: string;
  type: 'FOLDER';
  extension: null;
};

export type FileTree = Tree<FileLeaf>;

export type FilePagintaionResponse = Pagination<File[]>;

export type DownloadOptions = {
  chunkSize?: number;
  onProgress?: (progress: {
    loaded: number;
    total: number;
    percentage: number;
  }) => void;
};
