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

import { FileAccessType } from '../../api-authoring/interfaces/api-spec-handler.interface.js';

export type Kinds = 'Properties' | 'CORS' | 'API' | 'UriSchemes';
export enum Gateways {
  LWGW = 'dp-nano-gateway',
  WMGW = 'webm-gateway',
}

export enum GatewayLabels {
  LWGW = 'nano',
  WMGW = 'webMethods',
  DPGW = 'datapower',
}

export interface AssetDependencyInfoModel {
  ref: string;
  data: string;
  fileHandle: FileAccessType;
  project: string;
}

export interface BreadcrumbItem {
  key: string;
  label: string | JSX.Element;
  isCurrentPage?: boolean;
  title: string;
  sourceId?: string;
  sourceKey?: string;
}

export interface GenericComponentWrapperProps {
  kind: Kinds;
  apiVersion: string;
  file: FileAccessType;
}

export interface GenericComponentExtension {
  apiVersion: string;
  gateway: Gateways;
}
export interface GenericComponentProps<T, K = any> {
  policy: T;
  updatePolicy: (data: T) => Promise<void>;
  withMetadata?: boolean;
  extension?: GenericComponentExtension;
  dependency?: {
    activeDependentAsset: {
      [key: string]: AssetDependencyInfoModel;
    };
    clearDependentAssets: () => void;
    updateDependentAsset: (
      asset: K,
      key: string,
    ) => Promise<{
      [key: string]: AssetDependencyInfoModel;
    }>;
    setActiveDependentAsset: (
      fileHandle: FileAccessType,
      projectName: string,
      key: string,
    ) => Promise<{
      [key: string]: AssetDependencyInfoModel;
    }>;
    fromPolicySequence?: boolean;
  };
}
