import { FileListQueryType } from "../types/file-types";
import { FolderListQueryType } from "../types/folder-types";

export interface IFileDB {
  getPublicFile(fileID: string): Promise<any>;
  getPublicInfo(fileID: string, tempToken: string): Promise<any>;
  getFileInfo(fileID: string, userID: string): Promise<any>;
  getQuickList(userID: string, limit: number): Promise<any[]>;
  getList(
    queryData: FileListQueryType,
    sortBy: string,
    limit: number
  ): Promise<any[]>;
  getFileSearchList(
    userID: string,
    searchQuery: RegExp | string,
    trashMode: boolean,
    mediaMode: boolean
  ): Promise<any[]>;
  getFileListByIncludedParent(
    userID: string,
    parentListString: string
  ): Promise<any[]>;
  getFileListByOwner(userID: string): Promise<any[]>;
  getFileListByParent(userID: string, parent: string): Promise<any[]>;
  updateFileUploadedFile(
    fileID: string,
    userID: string,
    parent: string,
    parentList: string
  ): Promise<any>;
  updateFolderUploadedFile(
    fileID: string,
    userID: string,
    parent: string,
    parentList: string
  ): Promise<any>;
  setThumbnail(fileID: string, thumbnailID: string): Promise<any>;
  removeOneTimePublicLink(fileID: string): Promise<any>;
  removeLink(fileID: string, userID: string): Promise<any>;
  makePublic(fileID: string, userID: string, token: string): Promise<any>;
  makeOneTimePublic(
    fileID: string,
    userID: string,
    token: string
  ): Promise<any>;
  trashFile(
    fileID: string,
    parent: string,
    parentList: string,
    userID: string
  ): Promise<any>;
  restoreFile(fileID: string, userID: string): Promise<any>;
  removeTempToken(user: any, tempToken: string): Promise<any>;
  trashFilesByParent(parentList: string, userID: string): Promise<any>;
  restoreFilesByParent(parentList: string, userID: string): Promise<any>;
  renameFile(fileID: string, userID: string, title: string): Promise<any>;
  moveFile(
    fileID: string,
    userID: string,
    parent: string,
    parentList: string
  ): Promise<any>;
  moveMultipleFiles(
    userID: string,
    currentParent: string,
    newParent: string,
    newParentList: string
  ): Promise<any>;
  deleteFile(fileID: string, userID: string): Promise<any>;
  createFile(data: { filename: string; uploadDate: string; length: number; metadata: any }): Promise<any>;
  setVideoThumbnail(
    fileID: string,
    userID: string,
    thumbnailID: string
  ): Promise<any>;
}

export interface IFolderDB {
  getFolderSearchList(
    userID: string,
    searchQuery: RegExp | string,
    trashMode: boolean
  ): Promise<any[]>;
  getFolderInfo(folderID: string, userID: string): Promise<any>;
  getFolderList(
    queryData: FolderListQueryType,
    sortBy: string
  ): Promise<any[]>;
  getMoveFolderList(
    userID: string,
    parent?: string,
    search?: string,
    folderIDs?: string[]
  ): Promise<any[]>;
  getFolderListByIncludedParent(
    userID: string,
    parent: string
  ): Promise<any[]>;
  findAllFoldersByParent(parentID: string, userID: string): Promise<any[]>;
  moveFolder(
    folderID: string,
    userID: string,
    parent: string,
    parentList: string[]
  ): Promise<any>;
  renameFolder(folderID: string, userID: string, title: string): Promise<any>;
  trashFoldersByParent(parentList: string[], userID: string): Promise<any>;
  restoreFolder(folderID: string, userID: string): Promise<any>;
  restoreFoldersByParent(parentList: string[], userID: string): Promise<any>;
  trashFolder(folderID: string, userID: string): Promise<any>;
  createFolder(folderData: {
    name: string;
    parent: string;
    parentList: string[];
    owner: string;
  }): Promise<any>;
  deleteFolder(folderID: string, userID: string): Promise<any>;
  deleteFoldersByParentList(
    parentList: string[],
    userID: string
  ): Promise<any>;
  deleteFoldersByOwner(userID: string): Promise<any>;
}

export interface IUserDB {
  getUserInfo(userID: string): Promise<any>;
  findByEmail(email: string): Promise<any>;
  findByCreds(email: string, password: string): Promise<any>;
  createUser(email: string, password: string): Promise<any>;
  removeOldTokens(
    userID: string,
    uuid: string | undefined,
    minusTime: number,
    isTemp: boolean
  ): Promise<any>;
  removeTempTokenByValue(userID: string, token: string): Promise<any>;
}

export interface IThumbnailDB {
  getThumbnailInfo(userID: string, thumbnailID: string): Promise<any>;
  removeThumbnail(userID: string, thumbnailID: any): Promise<any>;
  createThumbnail(data: {
    name: string;
    owner: string;
    IV: Buffer;
    path?: string;
    s3ID?: string;
  }): Promise<any>;
}
