/**
 * Copyright IBM Corp. 2024, 2025
 */

import { TreeEntry } from '../../common/models/tree-entry.model.js';
import { APIChandle } from '../../common/interfaces/file-explorer-handler.interface.js';
import { APICFileInfo } from '../models/apic-file-info.model.js';
import { APICProject } from '../models/apic-project.model.js';

export interface IAPICFileHandler {
  saveFile(
    fileHandle: APICFileInfo,
    currentProject: APICProject,
    content: string,
  ): Promise<boolean>;
  updateFile(fileHandle: APICFileInfo, content: string): Promise<boolean>;
  createFile(
    orgId: string,
    projectId: string,
    projectName: string,
    directoryPath: string | undefined,
    fileName: string,
    content: string | Blob | any,
  ): Promise<any>;
  getAPICFileContent(apicFile: APICFileInfo): Promise<string>;
  getAllFilesFromTheProject(
    orgId: string,
    projectName: string,
  ): Promise<APICFileInfo[]>;
  getAPICFileDetails(project: APICProject): Promise<APICFileInfo[]>;
  deleteFile(fileInfo: APICFileInfo): Promise<APICFileInfo>;
  sendAPICFileToServer(
    orgId: string,
    projectId: string,
    path: string,
    content: string,
  ): Promise<APICFileInfo>;
  createDirectory(
    project: APICProject,
    directoryPath: string | undefined,
    directoryName: string,
  ): Promise<TreeEntry>;
  deleteFromIndexDb(fileKey: string): Promise<boolean>;
  moveAPICFile(
    item: APICFileInfo,
    targetDirectory: APIChandle,
    project: APICProject,
  ): Promise<APICFileInfo>;
  renameAPICFile(
    item: APICFileInfo,
    newName: string,
    project: APICProject,
  ): Promise<APICFileInfo>;
  getFileDetailsFromTheProject(project: APICProject): Promise<APICFileInfo[]>;
  removeIndexDbEntriesBasedOnProject(projectName: string): Promise<any>;
}
