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

import { APICFileInfo } from '../../apic-mode/models/apic-file-info.model.js';
import { VCSFileInfo } from '../../vcs/models/vcs-file-info.model.js';
import {
  AiCodeAugmentations,
  AiCodeAugmentationsGroup,
} from '../models/ai-augmentations.model.js';
import {
  AiErrorRemediations,
  AiErrorRemediationsGroup,
} from '../models/ai-error-remediations.model.js';
import {
  AiValidationErrorsGroup,
  ValidationError,
} from '../models/ai-validation-errors.model.js';
import { ApiMConfig } from '../models/api-m-config.model.js';

export type AIDataStoreActions = {
  setIsAiEnabled: (isAiEnabled: boolean) => void;
  setIsLoading: (isLoading: boolean) => void;
  setIsAiEnabledApiMAccount: (isAiEnabledApiMAccount: boolean) => void;
  setApiMConfig: (apiMConfig: ApiMConfig | null) => void;
  setAiCodeAugmentations: (
    aiCodeAugmentations: AiCodeAugmentationsGroup,
  ) => void;
  setAiCodeAugmentationsForFile: (
    filePath: string,
    aiCodeAugmentations: AiCodeAugmentations,
  ) => void;
  setAiErrorRemediations: (
    aiErrorRemediations: AiErrorRemediationsGroup,
  ) => void;
  setAiErrorRemediationsForFile: (
    filePath: string,
    aiErrorRemediations: AiErrorRemediations,
  ) => void;
  setAiValidationErrors: (aiValidationErrors: AiValidationErrorsGroup) => void;
  setAiValidationErrorsForFile: (
    filePath: string,
    validationErrors: ValidationError[],
  ) => void;
  loadApiMConfig: (connection?: any) => Promise<void>;
  clearAiAddedLines: () => void;
  setIsDataLoading: (isDataLoading: boolean) => void;
  generateAiEnhancements: (
    file: VCSFileInfo | FileSystemFileHandle | APICFileInfo,
    completeFilePath: string,
  ) => Promise<void>;
  /**
   * Apply the suggestions from WatsonX AI for the given spec paths for the given file
   * @param completeFilePath
   * @param specPaths
   * @returns
   */
  applyAiEnhancements: (
    completeFilePath: string,
    specPaths: string[],
  ) => Promise<void>;
  /**
   * Ignore the suggestions from WatsonX AI for the given spec paths for the given file
   * @param completeFilePath
   * @param specPaths
   * @returns
   */
  ignoreAiEnhancements: (completeFilePath: string, specPaths: string[]) => void;
  /**
   * Apply the rule remediation from WatsonX AI for the given spec paths for the given file
   * @param completeFilePath
   * @param specPaths
   * @returns
   */
  applyAiErrorRemediations: (
    completeFilePath: string,
    specPaths: string[],
  ) => Promise<void>;
  /**
   * Ignore the rule remediation from WatsonX AI for the given spec paths for the given file
   * @param completeFilePath
   * @param specPaths
   * @returns
   */
  ignoreAiErrorRemediations: (
    completeFilePath: string,
    specPaths: string[],
  ) => void;
  markManualFileSave: (
    completeFilePath: string,
    file: VCSFileInfo | FileSystemFileHandle | APICFileInfo,
  ) => Promise<void>;
  generateAiErrorRemediations: (
    file: VCSFileInfo | FileSystemFileHandle | APICFileInfo,
    completeFilePath: string,
  ) => Promise<void>;
  setCommonErrorRemediations: () => void;
};
